How to install APC and fix “potential cache slam” problem

APC is an Alternative PHP Cache or Opcode cache that speeds up performance dramatically by caching queries.

How to install APC?

apt-get install php5-apc


pecl install apc

You will have to enble it in the php configuration. Add the following to your php.ini file

Alternatively, you could create a separate apc.ini file and put it in the conf.d directory.

If your error log shows a lot of messages about potential cache slam averted, it is a bug. Not much you can do about it but you can turn slam defense off so that it doesn’t spam your logs (or cause other fails)

Add after that line in your php.ini or apc.ini

apc.write_lock = 1
apc.slam_defense = 0

Then copy the apc.php file into a folder that is served by your webserver. Accessing this script in a browser gives you information on the state of your cache. However this script also allows viewing of the files cached and may be a security concern, so it is best kept in a folder with restricted access.







Leave a Reply

Your email address will not be published. Required fields are marked *