Question

I have tried both of :

ini_set('include_path', '.:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes');

and also :

php_value include_path ".:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes"

in the .htaccess file.

Both methods actually do work but only intermittently. That is, they will work fine for about 37 pages requests and then fail about 42 pages requests resulting in an require() call to cause a fatal error effectively crashing the site.

I'm not even sure where to begin trying to find out what is going on!


@cnote

Looks like you duplicated the current directory in your include path. Try removing one of the '.:' from your string.

The in script version was originally

ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'classes');

and thus the .:.: was coming from the existing path:

ini_get('include_path')

I tried removing it anyway and the problem persists.

Was it helpful?

Solution

It turned out the issue was related to a PHP bug in 5.2.5

Setting an "admin_flag" for include_path caused the include path to be empty in some requests, and Plesk sets an admin_flag in the default config for something or other. An update of PHP solved the issue.

http://bugs.php.net/bug.php?id=43677

OTHER TIPS

Have you tried set_include_path()?. As a benefit this returns false on failure, allowing you to at least catch the occurence and generate some meaningful debug data. Additionally, you should be using the constant PATH_SEPARATOR as it differs between windows / *nix.

As a specific example:

set_include_path('.' . PATH_SEPARATOR . './app/lib' . PATH_SEPARATOR . get_include_path());

(the get_include_path() on the end means whatever your ini / htaccess path is set to will remain)

Looks like you duplicated the current directory in your include path. Try removing one of the '.:' from your string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top