简体   繁体   English

在httpd.conf中更改了DocumentRoot,$ _ SERVER ['DOCUMENT_ROOT']仍然相同

[英]Changed DocumentRoot in httpd.conf, $_SERVER['DOCUMENT_ROOT'] still the same

So I changed DocumentRoot in my httpd.conf files and $_SERVER['DOCUMENT_ROOT'] still seems to be the same on XAMPP. 因此,我在httpd.conf文件中更改了DocumentRoot ,而$_SERVER['DOCUMENT_ROOT']在XAMPP上似乎仍然相同。 I've restarted the server and the problem still persists. 我已经重新启动服务器,问题仍然存在。 I've change DocumentRoot before from the original xampp/htdocs folder and it worked fine. 我已经从原始的xampp/htdocs文件夹更改了DocumentRoot ,并且工作正常。 Any clues? 有什么线索吗?

Note the DOCUMENT_ROOT for PHP might not be the same as of Apache. 请注意,PHP的DOCUMENT_ROOT可能与Apache的DOCUMENT_ROOT不同。 DOCUMENT_ROOT is where the PHP file is located. DOCUMENT_ROOT是PHP文件所在的位置。 This could be on Document root or through a different directory. 这可以在文档根目录或通过其他目录。

There's another line in the httpd.conf file that needs changing. httpd.conf文件中还有一行需要更改。 In my file it was about 30 lines below the DocumentRoot setting. 在我的文件中,它大约比DocumentRoot设置低30行。 I found it thanks to the preceding comment line 我发现它是由于前面的注释行

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/work/htdocs">

I just moved the whole htdocs directory so I also had to change a line in the httpd-xampp.conf file as well. 我只是移动了整个htdocs目录,所以我还必须更改httpd-xampp.conf文件中的一行。

<Directory "C:/work/htdocs/xampp">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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