Linux

APC is the de-facto framework that optimizes PHP code. It reduces parsing and cache user data.

Installing APC is quite easy.

Install APC

The easiest way to install APC is via aptitude.

sudo apt-get install php-apc

Reading package lists... Done
Building dependency tree       
Reading state information... Done
php-apc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.

If you have it already installed, you may get something like the above.

It’s now currently installed however, you may want to view the statistics page where you can see your caches and how apc is working.

Install apc.php

apc.php is commonly found in /usr/share/php/apc.php. However, if you can’t find it, you can run the following command to find out where it is:

user@yourvps:~$ find / -name apc.php* 2>/dev/null
/usr/share/doc/php5-apcu/apc.php

In my case, it was found at /usr/share/doc/php5-apcu/apc.php. Copy this file to a web accessible location and view it through your browser.

user@yourvps:~$ cp /usr/share/doc/php5-apcu/apc.php /var/www/html/apc.php

View your apc.php Page

View your apc.php page in your browser. In between refreshes, you may see changes in the size of the cache.

APC is a very useful application which should be a must whenever you are working on any web application.