Apc.cache_by_default with CodeIgniter

I'm trying to use APC (PHP Alternate Cache) on my localhost using wamp 2, PHP 5.3 and CodeIgniter 1.7.2, however if I enable cache_by_default and enable apc.stat the server crashes and I get the following error:

[apc-error] Unable to override ci_benchmark class in C: \ WAMP \ WWW \ to \ MVC \ CodeIgniter \ common.php on line 127.

What can I do to fix this problem?

+2


a source to share


3 answers


Have you checked with this user to see if he has ever found a better solution than not enabling cache_by_default?

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



Is your production server windowed? I'm just asking because it's easy to waste a lot of time tracking down bugs and configuration issues that result from developing and working in different environments. If the production environment differs significantly from your development environment, this is another argument in favor of disabling caching in your dev block and moving to a more productive use of your time while developing your application.

+1


a source


When you disable apc.stat, apc seems to have problems with relative paths. CodeIgniter uses a relative path in the main index.php file, so it breaks things.

Open index.php and change this:

$system = '../system';

      



:

$system = '/var/www/system';

      

Replace '/ var / www /' with your full server path to the CodeIgniter system folder.

+1


a source


Try to change the requirement in this include_once function. This way the file will only be included once. In this function I mean: system / codeigniter / Common.php: function & load_class ($ class, $ instantiate = TRUE) I think this should help. I think APC is caching aggressively.

0


a source







All Articles