繁体   English   中英

如何将路径更改为根目录(PHP / Apache)?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM