Issue
I got a problem with the set_include_path, I read a lot of messages on that problem but none works for me. I'm on Debian and my root directory would be set to /home/project/
So I tried these 4 different things :
ini_set("include_path", '/home/project');
ini_set("include_path", '.:/home/project');
set_include_path('.:/home/project');
set_include_path('/home/project');
set_include_path(get_include_path().PATH_SEPARATOR.'/home/project');
But none works... when I do echo get_include_path(); it seems good each time.
But the 4th method works perfectly with WAMP on my computer.
Error message on ALL of these :
Warning: include(/config/config.php) [function.include]: failed to open stream: No such file or directory in /home/project/web/www.project.com/index.php on line 3
Warning: include() [function.include]: Failed opening '/config/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear:/home/project') in /home/project/web/www.project.com/index.php on line 3
Solution
Try to make use of the PATH_SEPARATOR
constant as it is done in the documentation.
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
Maybe it varies on the system you're deploying your application to..
UPDATE: The include path seems to be fine, but the problem is something different..
You shouldn't be including:
require '/config/config.php'
but
require 'config/config.php'
So drop the leading slash and it should work.
Answered By - André Hoffmann