PDA

Click to See Complete Forum and Search --> : $document_root


baart
Jul 5th, 2003, 04:14 PM
Why does this work in one script and not in another one:




if ( $DOCUMENT_ROOT == "c:/html_docs" )
{
$file_dir = "C:html_docs/mijn_documenten";
$file_url = "http://server/mijn_documenten/";
}

elseif ( $DOCUMENT_ROOT == "/www/clingse" )

{
$file_dir = "/home/clingse/www/mijn_documenten";
$file_url = "http://clingse.com/mijn_documenten/";
}


It is handy because I am running PHP local on windows 2000 and my ISP is running unix.
I am getting parse errors in one file undefined Var $DOCUMENT_ROOT BUT NOT in another script in the same dir and the same computer??????
I am looking a this problem for to long now I need help.
Thanks in advance
Brian

The Hobo
Jul 5th, 2003, 10:05 PM
Probably because they are differing versions of PHP. Since PHP 4.1, $DOCUMENT_ROOT is deprecated, and register_globals is turned off by default.

Use $_SERVER['DOCUMENT_ROOT'] instead. It should work in both.