Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

PHP and $_SERVER["DOCUMENT_ROOT"] problem

Discussion in 'General Discussion' started by greyboy, Jun 23, 2005.

  1. greyboy

    greyboy Member

    Joined:
    Jun 28, 2003
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    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
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. greyboy

    greyboy Member

    Joined:
    Jun 28, 2003
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    151
    Thank you. That makes perfect sense.

    -N
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    166
    No problem - it had me stumped when I first encountered it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice