On Ubuntu 12.04 LTS (Precise Pangolin) the repositories already contain a package called php-apc that works very well. There is no need to install APC using pecl at all as in the article below.
Complex PHP applications, such as Drupal, can gain a lot of performance benefits from running a PHP op-code cache/accelerators.
APC, Alternate PHP Cache, is now the most maintained free/open source op-code cache, and is being used more and more as it emerges to be the most stable.
The instructions here detail how to get APC running on an Ubuntu server running Gutsy Gibbon 7.10.
First, we need the pecl command so we can download and install APC from the repositories.
Do to so, we execute the following command:
aptitude install php-pear
But, this will not run on its own, we need the following package for the phpize command:
aptitude install php5-dev
We also need the apxs command, which is installed via the following package:
aptitude install apache2-dev
Now we have all the software we need, so we install apc via the pecl command:
pecl install apc
Once that finishes, we need to enable apc in Apache's configuration. the following command should do this for us.
echo "extension=apc.so" > /etc/php5/apache2/conf.d/apc.ini
Then we restart Apache:
And we are all done. Watch for less execution time per page, and decreased memory usage per Apache process compared to what you had before.