Install APC on Ubuntu 12.04

APC (alternative page cache) is an addon to php to increase execution time of PHP scripts. To do so APC caches previously compiled bytecode of PHP code which can be reused in later page requests. The install on Debian/Ubuntu based Linux distributions (in my case Ubuntu 12.04) is quite simple.

sudo apt-get install php-apc
sudo service apache2 restart


sudo service php5-fpm restart

if you don’t use mod_php but php5-fpm with apache.

After install you should download the apc.php from the pecl repository The following line will download apc.php from version 3.1.10:

wget -O apc.php

Upload this file to your webserver root. By calling the script you get a statistical representation of your memory used for APC. If your running a website which consumes a lot of memory, APC will unluckily fragment your memory cache a lot. Also the value Cache full count will increase. In that case you should increase the memory limit until it fits your needs by adding the following line to the apc configuration file apc.ini which can be found in /etc/php5/conf.d:


Enjoyed this post? Share it!