altsyset
altsyset

Reputation: 339

The meaning of this include path syntax

I have a problem with configuring my app in a server and googling and looking around I landed on this page which pretty much is my problem but I still don't know how to change this into my situation so could someone explain the syntax of this expression.

 include_path = ".:/usr/lib/php:/usr/local/lib/php"

Upvotes: 3

Views: 1547

Answers (3)

John Conde
John Conde

Reputation: 219824

That is just a colon-delimited list of directories that PHP will search for files that are called via include() and require() (and their include_once() and require_once friends). If you want to add your own directories you would add them as such:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/path/to/your/includes"

/path/to/your/includes is the sample path to where your included files will be

Upvotes: 3

Thom Wiggers
Thom Wiggers

Reputation: 7054

This is a linux $PATH specification. It's a list of folders, separated by :s, in which PHP will look for files which you try to require or include. . means the current working directory.

Upvotes: 4

deceze
deceze

Reputation: 522125

The include_path is all the paths in which PHP will look for the file when you use include('file') (or require or the _once derivatives). It is several paths separated by :. The . path is the current working directory.

So, when you include('file.php'), PHP will first look for ./file.php (in the current directory), then /usr/lib/php/file.php, then /usr/local/lib/php/file.php and it will use the first file it finds.

Upvotes: 3

Related Questions