PHP with APC: Fatal errors: Cannot redeclare class

后端 未结 7 1991
甜味超标
甜味超标 2020-12-24 07:57

Since I installed APC for PHP with PECL I get sometimes these errors: Cannot redeclare class xxx

xxx changes from time to time. I could disable APC but

7条回答
  •  鱼传尺愫
    2020-12-24 08:24

    Hmmm, seems to be a common issue:

    • Opcode (APC/XCache), Zend, Doctrine, and Autoloaders
    • http://forums.zend.com/viewtopic.php?f=69&t=813
    • http://framework.zend.com/issues/browse/ZF-8588

    What I just noticed from your specific error message is that you wrote zend_db_adapter_abstract in all-lowercase. A problem with the horrid framework naming schemes and autoloaders is that they keep files in mixed case and expect it so. If your code tried to instantiate it this way, the autoloader might not have found it. APC might be more peculiar here, since it overrides include_once internally, maybe with side-effects.

    A solution would be to adapt the Zend autoloader, and manually keep a list of loaded classes and (absolute and lowercased) filenames to proofcheck in lieu of include_once.

    Otherwise, try excessive xdebug-ing. Without access to your setup, all we can do is guess here.

提交回复
热议问题