How to list the required require_once () paths in PHP?

We all saw this error before:

Warning: require_once(test/blah.inc) [function.require-once]: failed to open stream: No such file or directory in /home/narf/narf.inc on line 3

Fatal error: require_once() [function.require]: Failed opening required 'test/blah.inc' (include_path='.:/usr/lib64/php:/usr/lib/php:/home/narf/inc:/home3/narf/php:/home3/narf/inc/dev:') in /home/narf/narf.inc on line 3

Super annoying.

Here's what I'm looking for: Some kind of PHP snippet that will list the paths that are searched for for the included file.

From what I see, I set my path correctly (the above script is just a manufacture), and I can successfully include the file from other parts of the project.

However, I just can't get it to work. If I had a list of places I was looking for, I could easily track the path that I am missing and determine why my require / include is not working.

Thoughts? Does anyone have a fragment that can separate them?

Thanks for the million! :)

: , , , -, , !:)

2: , . , , . , , , require() include() . , , , (), ..

+3
3

include:

, , include_path.
include_path, include(), , script


include_path - , ():

, require(), include(), fopen(), file(), readfile() file_get_contents() .

php.ini , set_include_path().

, , , get_include_path().

+2

get_include_path()

+6

The path is indicated in the error message: these are the values ​​in include_path

+1
source

All Articles