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 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.
Edit/Update (from comments):
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
Without all 3, I'd constantly get the error, but with all three I seem to no longer get the error :)!
I had the same problem with a bunch of PHP libraries as soon as I enabled APC. After a lot of hair pulling I found that setting apc.include_once_override = 0
cleared things up. Still monitoring but haven't had a the problem re-occur (before that I was able to induce the error by clearing the apc cache).
This error happened when using Amazon's AWS SDK
for PHP2
in a php script running under cron
. One solution was to disable apc
via -d apc.enabled=0
as shown below:
/usr/bin/php -d apc.enabled=0 /path/to/myshelljob.php
For more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With