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

kq0g1dla  于 2022-11-16  发布在  Apache
关注(0)|答案(1)|浏览(136)

现在我使用的文件路径(在数据库中)如下
“/files/person_1/awatar.png”-它工作,文件_获取_内容(“/文件/个人_1/awatar.png”)=真-是好的!
但是现在我改变了我的web服务器并且...在PHP中我可以看到“目录未找到异常”
服务器上的路径:在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>
r6vfmomb

r6vfmomb1#

转到以下位置并将根文件夹更改为桌面上的本地文件夹。

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"

希望能帮上忙。

相关问题