SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy $_SERVER['DOCUMENT_ROOT'] issues w/IIS

    I am sorry if this has been beat to death but...

    I am running on IIS server and this code below:

    PHP Code:
    <?php

    echo $_SERVER['DOCUMENT_ROOT'] . '/xml/';
    echo 
    '<br />';
    echo 
    $GLOBALS['DOCUMENT_ROOT'] . '/xml/';
    echo 
    '<br />';
    echo 
    $DOCUMENT_ROOT  '/xml/';
    ?>
    outputs this:

    /xml/
    /xml/
    /xml/

    Is this a IIS bug or somethign I am doing wrong? I am tired of hard coding paths

  2. #2
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works ok for me! Try running phpinfo() and see what the server variables contain. Or switch to Apache.

  3. #3
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simply swithing to Apache is not an option. Thanks for suggestion!

    Tried with gloabls on and off still outputs the same.

  4. #4
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you try phpinfo() to see what is set?

  5. #5
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    From the PHP manual (feedback section)

    $_SERVER['DOCUMENT_ROOT'] is supported by IIS, although only when running PHP as an ISAPI module.

    You can add $_SERVER["DOCUMENT_ROOT"] to IIS by editing the Environment Variables of your Windows server (was tested on WinXP SP2).

    Right click on My Computer >> Properties >> Advanced.
    In the System variables click on 'New' and Type in the name field 'DOCUMENT_ROOT' and in the value field the path to your IIS document root folder.

    Don't forget to restart your Windows (IIS restart won't load the new settings).
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  6. #6
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    God Bless the French! :-)

    Thank you I'll edit this post as to outcome!

  7. #7
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tecknowjnkie
    God Bless the French! :-)
    Indeed.... else I wouldn't have a house

    Good luck
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •