Undefined variable: DOCUMENT_ROOT

A

Anonymous

Guest
Hi!
I'm to have this problem. :!:
But if you carefully see at the httpd.conf in Apache, you can see next:
#AddModule mod_headers.c :!:
All this variables not permit Apache.
 
or $_SERVER['DOCUMENT_ROOT']

This also affects accessing posta nd cookies variables.
 
I do not know how you config yours Apache and PHP, but at my comp all work

OS Windows 98SE

Apache: 1.3.24
PHP: 4.2.1

Than I type next in test.php:
Code:
<?PHP
echo ($HTTP_SERVER_VARS['DOCUMENT_ROOT'])
?>
I see in my local server http://student/test.php:
c:/apache/apache/htdocs
 
you have just to open the httpd.conf file and search the variable DOCUMENT_ROOT then change it to the appropriate value !! :lol:
 
This is from my httpd.conf. I have commented out the default location they chose and changed it to a more genearl /var/www/html
Make this change yourself (to wherever you want your web root), stop and start apache.
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "/usr/local/apache/htdocs"
DocumentRoot "/var/www/html"

getenv("DOCUMENT_ROOT") also works for me, without having to worry about register_globals ...
 
Back
Top