PHP and $_SERVER["DOCUMENT_ROOT"] problem

greyboy

Member
Jun 28, 2003
8
0
151
A quick search of the forum didn't show any previous threads with this topic.

I'm curious why $_SERVER["DOCUMENT_ROOT"] is filled with "/usr/local/apache/htdocs" instead of the path for the particular domain in question. My experience with all other administration software has been the opposite.

So, is there a way to fix this? And if so, where do I start looking?

Thanks,
-N
 

webignition

Well-Known Member
Jan 22, 2005
1,880
0
166
PHP uses whatever value is picked up from httpd.conf.

If you're visit a site via http://yourIP/~example/, the relevant document root as specified in your httpd.conf won't come into play and so the default will be used.

On the otherhand, if you visit a site http://example.com/, the relevant document root as specified in your httpd.conf will be used.