views:

283

answers:

2

I'm trying to use APC (Alternative PHP Cache) on my localhost with wamp 2, PHP 5.3 and CodeIgniter 1.7.2, however If I turn on cache_by_default and enable apc.stat the server will crash and I get the following error:

[apc-error] Cannot redeclare class ci_benchmark in C:\wamp\www\k\mvc\codeigniter\Common.php on line 127.

What can I do to fix this issue?

A: 

Did you check with this user to see if he ever found a better solution than not enabling cache_by_default?

Does this only happen when you enable apc.cache_by_default AND apc.stat? For performance reasons, you don't want to run apc.stat on a production server. And there is no need to run caching on a dev server at all, other than as a final check before moving to production, at which time you can manually clear the cache.

Is your production server a windows box too? I'm simply asking because it's easy to lose a lot of time tracking down bugs and configuration issues that result from developing and running on different environments. If the production environment is substantially different from your dev environment, this is another argument in favor of turning off caching on your dev box and moving on to the more productive use of your time - developing your app.

coolgeek
The link to the other thread is by me and I didn't find a solution for this, thats why I posted my question here. This does only happen when I run both cache_by_default AND apc.stat, even though you should have stat disabled on a production server I want to know why this is happening. My production server won't be a windows machine.
Dennis
A: 

Try changing the requires in that function to include_once. So the file will be only included once. In this function I mean: system/codeigniter/Common.php: function &load_class($class, $instantiate = TRUE), I guess that should help. I think APC is caching to aggresively.

Michiel