SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Russia
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Undefined variable: DOCUMENT_ROOT

    I'm trying to execute a samle PHP program.
    But whenever I open a page it gives me errors/warnings
    like this:
    PHP Code:
    WarningUndefined variableDOCUMENT_ROOT in C:\InetPub\wwwroot\chat\chat\config\config.lib.php on line 2

    Fatal error
    Failed opening required '/design/db.php' (include_path=''in C:\InetPub\wwwroot\chat\chat\config\config.lib.php on line 2 
    this "line 2" looks like this:
    PHP Code:
    require($DOCUMENT_ROOT."/design/db.php"); 
    If I write in a .php page this line
    PHP Code:
    $DOCUMENT_ROOT "C:\InetPub\wwwroot"
    then everything works fine.

    I was told that $DOCUMENT_ROOT works only in xNUX,
    and that I should write the above line in every page.

    Is it true ?
    Regards,
    Alexander Saprykin
    http://www16.brinkster.com/saprykin

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Russia
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to execute a sample PHP program.
    But whenever I open a page it gives me errors/warnings
    like this:
    PHP Code:
    WarningUndefined variableDOCUMENT_ROOT in C:\InetPub\wwwroot\chat\chat\config\config.lib.php on line 2

    Fatal error
    Failed opening required '/design/db.php' (include_path=''in C:\InetPub\wwwroot\chat\chat\config\config.lib.php on line 2 
    this "line 2" looks like this:
    PHP Code:
    require($DOCUMENT_ROOT."/design/db.php"); 
    If I write in a .php page this line
    PHP Code:
    $DOCUMENT_ROOT "C:\InetPub\wwwroot"
    then everything works fine.

    I was told that $DOCUMENT_ROOT works only in xNIX,
    and that I should write the above line in every page.

    Is it true ?
    Regards,
    Alexander Saprykin
    http://www16.brinkster.com/saprykin

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Russia
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to execute a sample PHP program.
    But whenever I open a page it gives me errors/warnings
    like this:

    Warning: Undefined variable: DOCUMENT_ROOT in C:\InetPub\wwwroot\chat\chat\config\config.lib.php on line 2

    Fatal error: Failed opening required '/design/db.php' (include_path='') in C:\InetPub\wwwroot\chat\chat\config\config.lib.php on line 2

    this "line 2" looks like this:
    require($DOCUMENT_ROOT."/design/db.php");

    If I write in a .php page this line
    $DOCUMENT_ROOT = "C:\InetPub\wwwroot";
    then everything works fine.

    I was told that $DOCUMENT_ROOT works only in xNIX,
    and that I should write the above line in every page.

    Is it true ?
    Regards,
    Alexander Saprykin
    http://www16.brinkster.com/saprykin

  4. #4
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You've just posted the same thing three times.

    According to http://lists.omnipotent.net/php3/199806/msg00123.html , the Web server sets the DOCUMENT_ROOT value, and it doesn't have anything to do with PHP.

    This appears to be a list of IIS/PWS server variables:
    http://www.google.com/search?q=cache...=en&lr=lang_en|lang_fr

    So, most likely, IIS does not set that var.

  5. #5
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And if you're in a function, make sure that you pulled the ol' global $DOCUMENT_ROOT on it.


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
  •