Re: Include Bug?

From: Date: Fri, 06 Jun 2003 19:06:02 +0000
Subject: Re: Include Bug?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-150531@lists.php.net to get a copy of this message
On Fri, Jun 06, 2003 at 10:19:10AM -0700, Steven Walker wrote: > I get it... so instead I should use: > > include("/usr/home/sites/www.walkereffects.com/web/test/include.php") I would recommend using your .htaccess file, or ini_set, or something else to set your include_path variable to contain '/usr/home/sites/www.walkereffects.com/' or something like that. Your include() call can then just look like: <? include('web/test/include.php'); ?> and it'll work from anywhere, regardless of where the file that's doing the including is located [1]. As a bonus, if you ever change hosts, or your host re-organizes its directory structure, and all of your includes rely on the include_path, simply re-set include_path, and your site works again. joel [1] Of course, the order of directories in your include_path matters, too. If it contains '.:/usr/home/sites/www.walkereffects.com/', then a file matching in the current working directory will take precedence over the one in your site root. So keep that in mind... -- [ joel boonstra | gospelcom.net ]

« previous php.general (#150531) next »