[Q] Using $_SERVER['DOCUMENT_ROOT'] correctly

From: Date: Tue, 13 Jul 2004 02:34:21 +0000
Subject: [Q] Using $_SERVER['DOCUMENT_ROOT'] correctly
Groups: php.general 
Request: Send a blank email to php-general+get-190306@lists.php.net to get a copy of this message
I'm attempting to define a set of environment variables that will allow me to edit and test my web pages on my local machine and then upload to my ISP for verification and publication without having to change any symbols. What variable should I use for the document root? Here's how some of the symbols were defined: $WWWROOT = $_SERVER['DOCUMENT_ROOT']; // Set up the dev directory's environment variables. $PROJECT_DIR = $WWWROOT.'/my_web_site'; $MEMBERS_DIR = $PROJECT_DIR.'/members'; ... etc, On my machine (a winxp system), the symbols and path get set properly and everything works great. However, when I upload the pages to my ISP's machine (a unix system), I get a 404 page not found error when trying to dispatch to /home/mtpweb/public_html/my_web_site/members/member_login.htm (the file exists On my local machine $_SERVER['DOCUMENT_ROOT'] is c:/program files/apache group/apache/htdocs On my ISP's machine the path is /home/mtpweb/public_html. Should I be using something other that $_SERVER['DOCUMENT_ROOT']? Cheers, Michael

« previous php.general (#190306) next »