The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    1
    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:
    36
    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.
     
  3. greyboy

    greyboy Member

    Joined:
    Jun 28, 2003
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    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:
    36
    No problem - it had me stumped when I first encountered it.
     
Loading...

Share This Page