PHP with APC: Fatal errors: Cannot redeclare class

后端 未结 7 1977
甜味超标
甜味超标 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条回答
  •  旧时难觅i
    2020-12-24 08:12

    I just had this happen to me, and I didn't find the solution suggested in any of the other answers. I am using various autoloaders including Composer autoloader and an older version of the Zend Framework Autoloader.

    The problem turned out to be caused by a slight name mismatch between the file name and the class name. One character different between the class name and the file name - a discrepancy that a human could easily miss but the a couple of autoloaders successively included the same file, causing the error.

提交回复
热议问题