Home / Linux/Unix/BSD / Install APC for PHP on Debian 5 Lenny

Install APC for PHP on Debian 5 Lenny

I have recently moved from hosting on a CentOS box to Debian and needed to install PHP’s APC opcode cache on it. I’ve posted about how to do this before on a CentOS box which is a very manual process and now add this post to install APC on Debian which is much easier.

As the root user or using sudo run the following command:

aptitude install php-apc

Everything else is done for you and all that is needed now is to gracefully reload Apache, again running as the root user or using sudo:

apache2ctl graceful

The configuration file is at /etc/php5/conf.d/apc.ini should you wish to change any of the settings such as the APC memory size etc.

If you want to have a page showing the current APC statistics, run the following command:

gzip -dc /usr/share/doc/php-apc/apc.php.gz > /path/to/apc.php

Make sure /path/to/apc.php is a location available in a web browser (and ideally password and/or IP address restricted) and then you can view detailed statistical information. I have some screenshots available here from an older post.