Installing PHP APC on GNU/Linux Ubuntu

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 "" > /etc/php5/apache2/conf.d/apc.ini

Then we restart Apache:

 /etc/init.d/apache2 restart

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.

About 智足者富


电子邮件地址不会被公开。 必填项已用*标注


<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>