Re: include() and require() and include_path
| From: | (Richard Lynch) | Date: | Fri, 30 Jun 2000 21:43:04 +0000 |
| Subject: | Re: include() and require() and include_path | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4174@lists.php.net to get a copy of this message | ||
In article <20000624095710.BVC16877@master>, toxlists@canada.com
(Jennifer) wrote:
> I have only found a few references to include_path. One mentions that it
> can be set with an Apache directive, but I haven't been able to find out
> what directive or what the syntax is or where to put it.
PHP4: php_value include_path "./:/path/to/your/home/dir/:/some/other/path/"
PHP3: php3_include_path "./:/path/to/your/home/dir/:/some/other/path/"
> Is the include_path path relative to the file that is calling it, relative
> to server_root, or document_root or something else?
Relative to file that is doing the include/require, or absolute if the
path starts with '/'.
Similarly, include/require can bypass include_path by using full path
starting with '/'
> I set a couple of variables in one file and then required another by HTTP
> which prints these varibles and the variables didn't print out. But if I
> move all files into the same directory and require just the file, then they
> print. I'm just trying to test how everything relates to each other.
Should work. include/require just copies&pastes the source in there, and
then does it. require does it once only, include does it each time the
line is encountered.
> I want to have one create_iim.inc in a common location.
That would be easiest by having the path to create_iim.inc be in your
include_path, *OR* just use require '/full/path/to/create_iim.inc';
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)