include_path
Moderator: General Moderators
include_path
my include_path in php.ini is set to include the PEAR directory which i imagine is pretty standard. My question is, what exactly does it do? how do i include classes that are inside the PEAR directory in my .php pages?
You can directly instead of
Code: Select all
include 'DB.php'Code: Select all
include '/path/to/pear/DB.php';- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
set_include_path() and get_include_path() may be of interest.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
I don't know.. I've never checked. Swiftmailer is so well put together, I get lost in amazement every time that I read the code. HTML Purifier is a lot easier to follow, but I'm a bit more familiar with HTML and lexers than anything e-mail related.guitarlvr wrote:That's pretty sweet. is that where most developers put libraries such as swiftmailer, template lite, html purifier, etc?
I hope they did, though. I've ran into problems where PHP isn't exactly sure which folder I'm referring to without the absolute path of __FILE__.
The answer is pretty simple: the first one it finds. (this and the order of searching is somewhere in the documentation, but i can't find it right now)miro_igov wrote: But if you have multiple include paths and for some reason there are files with same names i wonder which one will be included
(Aha, i found it: http://be2.php.net/manual/en/function.include.php)
Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory.