APC errors appear to be temporarily fixed by re-installing

I have a Linode 512 with Ubuntu 10.10, Apache, MySQL, PHP with which I have installed php-apc to speed my Zend Framework application up a bit. Every so often, I'm pretty sure it's when I push the latest version of the source code to the server, I start getting APC errors notifying me of class redeclaration…

[Tue Mar  1 15:18:37 2011] [apc-error] Cannot redeclare class zend_locale_math in /var/www/foo/library/Zend/Locale/Format.php on line 301.

Different parts of the web application break each time this happens, and it can be fixed by removing and re-installing php-apc and the site runs fine again until the next lot of source code is pushed to the server (I think).

Does anyone have any ideas as to what might be happening, and how I could fix this properly?

14 Replies

I'm pretty sure you'd find out that just restarting your Apache (or the php-fastcgi process tree, if applicable) would be enough to fix it, no need to reinstall.

Bah, even erasing the cache using apc-info.php might be enough.

It has all signs of a bug in APC, and from time to time happens to me too, on Debian 5 (still). I'm not using Zend Framework, but it's the very same mixup of old and new versions of the file.

Thanks for the tips rsk, I just forced it to happen again by updating some of the files and restarted Apache didn't appear to fix it, at least not straight away… I then tried clearing the cache with apc.php with still no immediate effect. After a couple of page refreshes it then started working again.

I'll have to look up the APC bug tracker and see if this is an issue.

are you running apc 3.1.7?

3.0.19 here. Ye Olde Debian. ;)

I'm running 3.1.3p1 (with PHP 5.3.3-1ubuntu9.3) - I guess it would be a good idea to be running the latest version, though I'm not sure how easy this would be as I have installed with aptitude.

Would I need to remove with aptitude, then install manually from PECL?

Some might disagree with me, but it's best to stick to distro repo packages whenever possible. That said, Chris Lea maintains a few PPA repositories that have the latest version of php-apc for a variety of different versions of Ubuntu. No idea about the reliability/stability of his repo, but that'd be the easiest way to do it.

What's the value of your "fileupdateprotection" when you do phpinfo()?

Also how are you running php? I've never seen this issue with apc.


What's the value of your "fileupdateprotection" when you do phpinfo()?

This is set to 2.


Also how are you running php? I've never seen this issue with apc.

It was installed with "apt-get install php5", as far as I'm aware, I haven't done anything to change the way in which it runs.

Run phpinfo() and does it say cgi/fastcgi or apache2 handler?


Run phpinfo() and does it say cgi/fastcgi or apache2 handler?

Apache 2.0 Handler

What's the output of apache2 -m | grep mpm

root@wserv:~# apache2 -m | grep mpm apache2: illegal option -- m root@wserv:~# apache2 -M | grep mpm apache2: bad user name ${APACHE_RUN_USER} root@wserv:~# apache2 -l Compiled in modules: core.c mod_log_config.c mod_logio.c prefork.c http_core.c mod_so.c

Hrmm don't see anything wrong with that then.

Try setting apc.stat to 0 in your php.ini, restart apache then see if the problem goes away.

It's known bug of 'lazy' functions.


apc.lazy_functions = 0
apc.lazy_classes = 0


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct