<p>I have inherited a client site which crashes every 3 or 4 days. It is built using the zend-framework with which I have no knowledge.</p>

<p>The following code:</p>

<pre><code>&lt;?php
    // Make sure classes are in the include path.
   ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'classes');

    // Use autoload so include or require statements are not needed.
    require_once 'Zend/Loader.php';
    Zend_Loader::registerAutoload();

    // Run the application.
    App_Main::run('production');
</code></pre>

<p>Is causing the following error:</p>

<pre>
[Tue Sep 02 12:58:45 2008] [error] [client 78.***.***.32] PHP Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in /srv/www/vhosts/example.co.uk/httpdocs/bootstrap.php on line 6 
[Tue Sep 02 12:58:45 2008] [error] [client 78.***.***.32] PHP Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.:.:/usr/share/php5:/usr/share/php5/PEAR') in /srv/www/vhosts/example.co.uk/httpdocs/bootstrap.php on line 6 
</pre>

<p>I don't even know where to begin trying to fix this. My level of knowledge of PHP is intermediate but like I said, I have no experience with Zend. Also, contacting the original developer is not an option.</p>

<p>The interesting thing is that even though the code is run every time a page of the site is hit the error is only happening every now and then.</p>

<p>I believe it must be something to do with the include_path but I am not sure.</p>

[{'answer_id': 39372, 'author': 'Adam Wright', 'author_id': 1200, 'author_profile': 'https://Stackoverflow.com/users/1200', 'pm_score': 1, 'selected': False, 'text': '<p>The fact that it only happens sporadically makes me think this is less of a programming issue, and more of a sysadmin issue - if it were a defect in the implementation, you\'d expect it to fail consistently considering the error is "No such file or directory". Two guesses</p>\n\n<ul>\n<li><p>There are multiple front-end web servers, and one of them is mis-configured (missing the Zend Framework).</p></li>\n<li><p>The  PEAR include directory is network mounted, and occasionally vanishes for short periods of time.</p></li>\n</ul>\n\n<p>It could be a more insidious file system problem, but one would think this would effect more than just one file.</p>\n'}, {'answer_id': 39387, 'author': 'Robin Barnes', 'author_id': 1349865, 'author_profile': 'https://Stackoverflow.com/users/1349865', 'pm_score': 3, 'selected': True, 'text': "<p>for a start I think your include path should maybe have a trailing slash. Here is an example of mine :</p>\n\n<pre><code>    set_include_path('../library/ZendFramework-1.5.2/library/:../application/classes/:../application/classes/excpetions/:../application/forms/'); \n</code></pre>\n\n<p>You bootstrap file will be included by another file (probably an index.php file). This means that if your include path is relative (as mine is) instead of absolute, then the path at which Loader.php is looked for changes if the file including bootstrap.php changes.</p>\n\n<p>For example, I have two index.php files in my Zend app, one for the front end, and one for the admin area. These index files each need there own bootstrap.php with different relative paths in because they are included by different index files, which means they <strong>have to be relative to the original requested index file, not the bootstrap file they are defined within</strong>.</p>\n\n<p>This could explain why your problem is intermittent, there could be another file including the bootstrap somewhere that is only used occasionally. I'd search through all the sites files for 'bootstrap.php' and see all the places which are including / requiring this file.</p>\n"}, {'answer_id': 498733, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>I had the same problem, but problem was in permissons to files. I gave chmod for all RWX and now is everything fine.</p>\n\n<p>So maybe someone else will have same problem as me, then this was solution.</p>\n\n<p>Regards</p>\n'}, {'answer_id': 499560, 'author': 'rg88', 'author_id': 11252, 'author_profile': 'https://Stackoverflow.com/users/11252', 'pm_score': 0, 'selected': False, 'text': "<p>It works sometimes so there isn't anything inherently wrong on the PHP end of things (if the path was wrong it would never work... but it does, yes?). So what is causing Loader.php to be periodically inaccessible? I would suspect a permissions problem. Something that is making Loader.php or the directory that it is in inaccessible. Maybe a cron job is setting/reseting permissions? Check that first. See what permissions are when it is working and what they are when it is not. </p>\n"}, {'answer_id': 2833321, 'author': 'Rasmus', 'author_id': 341128, 'author_profile': 'https://Stackoverflow.com/users/341128', 'pm_score': 0, 'selected': False, 'text': '<p>In my case the Zend/Loader.php was not in the PEAR-directory. It should be there, but my webserver was a little raw. But you can insert it in the library/Zend directory as well.</p>\n\n<p>But indeed this does not answer why your problem occurs only sometimes.</p>\n'}, {'answer_id': 4401301, 'author': 'cdnicoll', 'author_id': 248487, 'author_profile': 'https://Stackoverflow.com/users/248487', 'pm_score': 0, 'selected': False, 'text': "<p>I had this error as well when I was working with PHPUnit 3.5.5. My main application script loaded the zend framework fine, however the test class ran into errors.</p>\n\n<p>My solution was to add the following to the test class</p>\n\n<pre><code>   ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'classes');\n\n    require_once 'ThemeWidgets.php';\n    require_once 'PHPUnit/Framework.php';\n\n    require_once '../../library/Zend/Loader/AutoLoader.php';\n\n\n    class ThemeWidgetsTest extends PHPUnit_Framework_TestCase\n    {\n\n        public function setUp() {\n            Zend_Loader_Autoloader::getInstance();\n        }\n...\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/39364', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/319/']