[英]How can I change path as root dir (PHP / Apache )?
現在我像這樣使用文件路徑(在數據庫中)
"/files/person_1/awatar.png" - 它有效,file_get_content ("/files/person_1/awatar.png") = true - 沒問題!
但是現在我更改了我的 web 服務器和...在 PHP 我可以看到“找不到目錄異常”
服務器上的路徑:/var/www/public_html/new_service_xxxxx/files/awatar.png 在 PHP 我有“/”作為第一個字符,我不想更改它。
我應該改變什么?
<VirtualHost *:80>
ServerName test.new_service_xxxxx.pl
ServerAlias www.new_service_xxxxx.pl
DocumentRoot /var/www/public_html/new_service_xxxxx
<Directory /var/www/public_html/new_service_xxxxxk>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm index.php5
</IfModule>
</VirtualHost>
Go 到以下位置並將根文件夾更改為桌面中的本地文件夾。
a) /etc/apache2/sites-available/000-default.conf
Change "DocumentRoot /var/www/html"
b) /etc/apache2/apache2.conf
Find "<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>"
And change "/var/www/html"
我希望它有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.