title: PHP + APC + Zend: Classes cannot be found
body: <p>I can't get APC to work properly with my Zend+Doctrine application. When I turn APC on I get the error:</p>
  
  <blockquote>
    <p>Fatal error: Access to undeclared static property: Zend_Loader_Autoloader::$_instance in /var/www/libs/Zend/Loader/Autoloader.php on line 92 </p>
  </blockquote>
  
  <p>I've seen lots of people complaining about that but no one seem to have solved their problem, except by this guy: <a href="https://stackoverflow.com/questions/6816443/access-to-undeclared-static-property-doctrine-odm-mongodb-mapping-driver-annotat">Access to undeclared static property: Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver::</a></p>
  
  <p>I tried that aproach, upgrading APC from 3.1.3 to 3.1.9. It didn't work for me.
  I tried enabling nclude_once_override:</p>
  
  <blockquote>
    <p>apc.include_once_override = 1</p>
  </blockquote>
  
  <p>Didn't work either.</p>
  
  <p>I also tried to get APC not to cache Zend_Loader_Autoloader by addint the following line to apc.ini:</p>
  
  <blockquote>
    <p>apc.filters = Autoloader.php</p>
  </blockquote>
  
  <p>It solved the primary problem, but caused another one:</p>
  
  <blockquote>
    <p>Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Zend_Loader' not found in /var/www/libs/Zend/Loader/Autoloader.php on line 472 Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Zend_Loader' not found in /var/www/libs/Zend/Loader/Autoloader.php on line 472 Fatal error: Class 'Doctrine_Event' not found in /var/www/libs/Doctrine/Record.php on line 801 </p>
  </blockquote>
  
  <p>Next thing I did was get APC not to cache Zend_Loader</p>
  
  <blockquote>
    <p>apc.filters = Autoloader.php,Loader.php</p>
  </blockquote>
  
  <p>Solves the problem above, but other classes can't be found:</p>
  
  <blockquote>
    <p>Fatal error: Class 'Zend_Exception' not found in /var/www/libs/Zend/Loader.php on line 99</p>
  </blockquote>
  
  <p>I got APC not to cache Zend_Exception, but other classes won't be found.</p>
  
  <p>Note that the errors occur only from the 2nd time the page loads on, after the cache is cleared. First page load works like a charm.</p>
  
  <p>Anyone faced a similar problem and was able to solve it?</p>
  
  <p>Thank you very much.</p>