Be careful not to get confused between a chrooted environment like the
web server or ftp server and php include paths. PHP handles the include
and require parameters either as absolute (eg /inc/filename is an
absolute path from / - it is not relative to the web docroot.) or
relative to the directories in the php.ini include directive. If you
want to simplify your include and require statements, specify the path
to 'inc' in php.ini and then express the paths to the included files
relative to that.

..michael..

On Wed, 2002-06-19 at 22:43, David Freeman wrote:
> 
>  > Is there a way to make include()/require() take a a full
>  > virtual path?  I.e.  require_once("/inc/myinc.php")?  It gets
>  > a little annoying to do require("../../../../file.php").
> 
> Sure, they should work either way.  The only real gotcha is knowing what
> a full path will be in relation to the web server when it goes to do the
> include/require.  For example, an include for '/inc/myinc.php' has
> particular meaning under *nix that may have it not work even though it
> looks that way to an ftp proggy.
> 
> Part of my normal configuration file for php projects is a declaration
> of $webroot as the path to a document as called from within a browser
> (ie. $webroot = "http://www.some.domain/some/directory";) and $fileroot
> as the path to a document as called from the filesystem (ie. $fileroot =
> "/home/some/user/directory") and then just append as appropriate (ie.
> Include($fileroot/inc/someinclude.php) and away you go.
> 
> CYA, Dave
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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

Reply via email to