In this tutorial, we will look at how to install APC (Alternative PHP Cache) on an Ubuntu system. As we should know, APC is a free and open framework which caches and optimizes the intermediate code generated when interpreting PHP scripts.
This improves performance since the PHP scripts don't have to be interpreted every single time they are run. You can think of APC as compiling your PHP scripts into small executable files.
This installation procedure works on Ubuntu 10.04, Ubuntu 10.10, Ubuntu 11.04, Ubuntu 11.10, Ubuntu 12.04, and earlier versions of Ubuntu as well. It works for the server versions of the aforementioned versions as well.
To install APC on Ubuntu 11.10 and others, execute the following code from a terminal (as root of course):
apt-get install php-apc
And that is it. There is no need to change any settings right out of the box. It just works.
Our own in-house tests show on average that the performance of our PHP scripts doubles. In other words, after installing APC we saw where our scripts on average ran twice as fast.
That is all there is to installing APC on Ubuntu. We hope this tutorial was useful.