Undefined variable: DOCUMENT_ROOT

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

Post Reply
User avatar
WiZARD
Moderator
Moderator
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Undefined variable: DOCUMENT_ROOT

Post by WiZARD » Sat Jun 22, 2002 11:38 pm

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.

Faithless

Post by Faithless » Sun Jun 23, 2002 6:54 pm

or $_SERVER['DOCUMENT_ROOT']

This also affects accessing posta nd cookies variables.

User avatar
WiZARD
Moderator
Moderator
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Post by WiZARD » Sun Jun 23, 2002 10:49 pm

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: Select all

<?PHP
echo ($HTTP_SERVER_VARS['DOCUMENT_ROOT'])
?>

I see in my local server http://student/test.php:
c:/apache/apache/htdocs

khote
New php-forum User
New php-forum User
Posts: 7
Joined: Tue Jul 23, 2002 6:15 am
Location: San Bernardino, Ca, USA
Contact:

Post by khote » Tue Jul 23, 2002 6:17 am

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 ...

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest