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

-- 
[ joel boonstra | gospelcom.net ]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to