Where is $DOCUMENT_ROOT?

travelgz

Registered
Hi,
I have this php website on some linux machine somewhere that is doing fine. I wanted to use my Mac OS X machine as a development server. So I downloaded all the php pages onto my tibook. PHP works after I installed the .so file from entropy and made changes to the apache config. BUT, for some reason, all my pages don't work because $DOCUMENT_ROOT is blank! How can it be blank?

The pages are referenced by using http://localhost/~username/blah.php, whereas on the live server it is http://somecompany.com/blah.php. Should there be a difference? I put on a test.php on /Library/Webserver/Documents and have it print out $DOCUMENT_ROOT, and again it failed! What gives? Does no one else have this problem? If so, can someone help? Is this a problem with entropy, os x, or just me? :-(

Thanks,
G
 
i just checcked the cgi script printenv, that apple included with OSX for debugging purposes:

i went to http://localhost:8080/cgi-bin/printenv
and among the results i saw:

DOCUMENT_ROOT:/Library/WebServer/Documents

so on my machine, this variable is not blank, and is in fact set to the correct location.

make that file executable, and check it yourself, tell us whether you see DOCUMENT_ROOT there. perhaps you messed up your httpd.conf file, because the value of that variable is taken from a line in that file. so make sure there is a line for DOCUMENT_ROOT in your httpd.conf file as well.
 
After much fussing I found out why. For some reason, my php doesn't have register_globals on! I had to create a php.ini in the /usr/local/lib dir and specify that it be on. Then everything started working!

I am a bit surprised that no one else who is using the entropy package needed to do that...

Thanks, folks!
T
 
Back
Top