Re: Website Architecture

From: Date: Thu, 05 Feb 2004 22:35:14 +0000
Subject: Re: Website Architecture
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-176951@lists.php.net to get a copy of this message
joel boonstra wrote:
On Thu, Feb 05, 2004 at 09:48:22PM +0000, Stuart wrote:
Eric Gorr wrote:
A solution I found was in dirA/index.php, to chdir( ".." ); before the require_once, which moves the current directory to SiteRootDir and allows otherfuncs.php to be found ... is this the best way to solve this problem?
Qualify relative paths by prepending $_SERVER['DOCUMENT_ROOT'].'/' - I usually define a constant at the start of all scripts like so... define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT'].'/');
Why not use php's include_path setting? No need to define constants, no need to worry about the location of your script relative to the document root, and it works with more functions than just include() and require(). I have found it to be the cleanest, most reliable, and most portable way to deal with file paths. joel
And if document root is different from include path? What if the include path is outside of document root? You CANNOT rely on include_path to accomplish this. -- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#176951) next »