Re: setting the document root path in linux

From: Date: Wed, 19 Sep 2007 14:46:26 +0000
Subject: Re: setting the document root path in linux
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-262242@lists.php.net to get a copy of this message
tbt wrote:
Hi I'm a newbie to php and I'm using require_once($_SERVER['DOCUMENT_ROOT']."/includes/class.announcement.php"); to import pages in php. This works fine on a windows environment. However when I move this application to a linux environment the files dont get imported properly. This is because in a windows environment $_SERVER['DOCUMENT_ROOT'] returns c:/xampp/htdocs etc. but in a linux environment returns /home/servers etc. How can this be rectified so that the path is properly picked up in a linux environment are you running apache on windows and linux?
if so, setup a .htaccess file that has a line in it that modifies the php include path place that .htaccess at your web root and you won't have to play with paths, you would call require_once 'includes/class.announcement.php'; instead Fix your include paths and you wont have to worry if the system will have what it should in the $_SERVER['DOCUMENT_ROOT']. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#262242) next »