include_path PEAR problem **PLEASE HELP**

OK. I’ve been spending the last 1 1/2 hours looking for a solution to this. I’m running a development server on my OpenSUSE 11.0 box and installed Apache2, PHP-5.2.9, MySQL and PEAR all using YAST, but no matter what I do I cannot include the installed PEAR packages in my PHP scripts. I figured out that the include_path configuration variable is being set to ‘.:’ despite the loaded php.ini file setting this variable as include_path = “.:/usr/share/php5:/usr/share/php5/PEAR”

It does not matter how I change the include_path variable and it does not matter if I remove the .: part. I’ve restarted apache2 many times and I still get the error message. It suggests to me that the path is being changed at some point but what could be changing it? Any ideas appreciated because this is a really frustrating problem :#

OH yes, and one of my error messages for good measure:

Fatal error: require_once() [function.require]: Failed opening required ‘File/Archive.php’ (include_path=’.:’) in /srv/www/htdocs/pitchfork/actions/pitchfork-action-file-decompress.php on line 16

There are a couple of places the include path can be set, one is php.ini (but be sure to get the right one, there’s one for apache2 and one for the cli PHP), and another is inside the Apache configuration for the app or the vhost configuration containing that app. Look for a line like this:

php_admin_value include_path ...

in the config file of the app somewhere in /etc/apache2/conf.d/ or perhaps /etc/apache2/vhosts.d/

@ ken_yap Wow! I didn’t expect an answer within minutes! Thanks for the advice but sadly I can’t find a file with that particular snippet within. Any other ways to override the include_path

Yes, the app itself can override the settings, so you would have to examine the PHP code. Presumably it should provide you with a way of configuring it. Look for a call like this in the PHP code:

ini_set("include_path", ...

No, I’ve tried files outside the application. They all point to the incorrect include path.

Put this short page on your server, what does it show for the include_path?


Do any of the .ini files displayed as having been read change the include_path?

OK. I resolved the issue. It appears I accidentally asked PHP to report one set of errors on one line of php.ini and and another set on another line. This caused a parsing error which meant that most of the file was ignored. It would have been good if Apache had told me that when it restarted each time.

Maybe it did. Did you look in /var/log/apache2/error_log?

Yep. I tailed error_log an it told me there was a parse error. After fixing the file, the include_path was then as it should have been. Thanks for the help!