Re: Re: best way to properly build an include path *regardless* from where I am calling the include?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Govinda wrote:


in my include statement, I am now successfully using:
/home/metheuser/public_html/
and am not anticipating moving this site.. but still I am thinking there must be a way to make the code bullet proof to dir/ name changes *after* the virtual server root.
Or do people just stop here?


I always define the include path explicitly, and it never includes anything inside the web root, but that's just me.

I use

$includeArray[]="/usr/share/pear";
$includeArray[]="/some/other/path";
$includeArray[]="/yet/another/path";

$incPath = impode(':',$includeArray);
ini_set("include_path",$incPath);

Since all my includes are external to the website where they don't ever need to moved no matter how I decide to change things, their paths never move. Served files inside the web root however can move around freely and always find their includes.

I admit, keeping all excludes outside the web root can be a bit tedious, but it helps keeps things well organized.

There's more than one way to do it though.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux