Setting include path in PHP intermittently fails. Why?
<p>I have tried both </p>

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

<p>in the code itself and also</p>

<pre><code>php_value include_path ".:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes"
</code></pre>

<p>in the .htaccess file.</p>

<p>Both methods actually <strong>do work</strong> 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.</p>

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

<p><hr /></p>

<p>@<a href="http://stackoverflow.com/questions/41836/setting-include-path-in-php-intermittently-fails-why#41877" rel="nofollow">cnote</a></p>

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

<p>The in script version was originally </p>

<pre><code>ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'classes');
</code></pre>

<p>and thus the .:.: was coming from the existing path:</p>

<pre><code>ini_get('include_path')
</code></pre>

<p>I tried removing it anyway and the problem persists.</p>
