Can't modify PHP include_path


So I’m trying to get my PHP include() statements to look for files in my webroot, and I can’t seem to get it to work.

I’ve tried putting

in an .htaccess file in the webroot (like I’d do on my localhost), and I’ve tried creating a phprc file containing

in /home//.php/5.4 (like it says on the wiki page for PHP.ini), but nothing happens. I just keep getting “Warning: include(): Failed opening for inclusion (include_path=’.:/usr/local/lib/php:/usr/local/php5/lib/pear’)”.

Can anybody help me figure out the correct way to do this? Google hasn’t been much help.

(And yes, I could replace "include " in all my files with

but that seems like the coward’s way out.)
Oh, I just got the idea that maybe it was a lack of PEAR that was causing the problem, so I went and installed it… but it doesn’t appear to have helped.


you could also put $_SERVER[‘DOCUMENT_ROOT’] in a variable before that and…


Just an update for posterity’s sake, to say that I think I’ve finally figured out the solution. You need to install PEAR locally, and then put the following in your phprc file:

If you have multiple subdomains that each need their own different include_path, make a file called .user.ini in the subdomain’s webroot and put that same line in there, changing the part as appropriate.


I do that all the time. Works a treat!


Be careful with HTTP_HOST, though. Unlike DOCUMENT_ROOT, it can be set by the user under some circumstances, and may contain incorrect or malicious information.