带有APC的PHP:致命错误:无法重新声明类 [英] PHP with APC: Fatal errors: Cannot redeclare class
问题描述
由于我使用PECL为PHP安装了APC,所以有时会出现以下错误:Cannot redeclare class xxx
Since I installed APC for PHP with PECL I get sometimes these errors: Cannot redeclare class xxx
xxx会不时更改.我可以禁用APC,但是APC可以大大提高性能!是否存在已知的错误,或者我可以做其他事情来防止这些错误?我正在将Ubuntu 8.04 LTS与PHP 5.2.4结合使用.
xxx changes from time to time. I could disable APC but APC improves the performance great! Is there a known bug or could I do something else to prevent these errors? I'm using Ubuntu 8.04 LTS with PHP 5.2.4.
编辑/更新(根据评论):
我使用Zend Framework Autoloader,并且在启用APC之前从未发生这些错误.不久前,我得到了例如以下错误:Fatal error: require(): Cannot redeclare class zend_db_adapter_abstract in /paths/app/lib/Zend/Db/Select.php on line 27
I use the Zend Framework Autoloader and these error never occurred before I enabled APC. A few moments ago I get for example that error: Fatal error: require(): Cannot redeclare class zend_db_adapter_abstract in /paths/app/lib/Zend/Db/Select.php on line 27
推荐答案
以下配置的组合为我修复了该问题:
The combination of the following configs fixed it for me:
apc.include_once_override = 0
apc.canonicalize = 0
apc.stat = 0
如果没有这3个,我会不断得到错误,但是有了 ,这3个我似乎都不再得到错误了:)!
Without all 3, I'd constantly get the error, but with all three I seem to no longer get the error :)!
这篇关于带有APC的PHP:致命错误:无法重新声明类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!