Installing APC (Alternative PHP Cache) Into PHP5 on Debian

Valic —  March 12, 2012 — 2 Comments

APC is a free and  open PHP5 opcode cacher for caching & optimizing PHP5 intermediate code.
It is similar to other PHP5 opcode cachers, such as eAccelerator & XCache.

1. Install APC on Debian:

APC is a PHP5 extension and we will install it using PECL.For that we need to install APC dependencies:

apt-get install php5-dev apache2-prefork-dev build-essential

Now install APC:

pecl install apc

2. Enable APC:

After install you need to enable APC. Add the following line in php.ini file:

echo “” >>/etc/php5/apache2/php.ini

3. Restart apache2 and verify if APC is running:

/etc/init.d/apache2 restart

And to verify APC create one file called phpinfo.php in /var/www/ directory .

touch phpinfo.php

and paste the fllowing:


Now navigate to http://your-ip/phpinfo.php  and you should now see APC mentioned on the page which means it has successfully been installated.


Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

2 responses to Installing APC (Alternative PHP Cache) Into PHP5 on Debian

  1. Don’t forget to configure APC, since by default it only uses 30Mb of cache..

    If your APC cache is too small, it can actually make your site a lot slower than without a cache, because PHP will always be freeing stuff from the cache to put new entries with every request. The objective of using APC is of having enough space allocated to it so that you keep “compiled” opcodes in RAM for faster access.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.