How to install APC from Source – Ubuntu

In some linux distributions or in particular cases you might want to avoid installing APC using the command apc-get.

Here's how to install it from the source code using any version you want.

0. Check the APC changelog

Go to and look for the desired version.

1. Uninstall a previous version

If you don't have APC installed you can skip this step and go to the next one.

Otherwise, uninstall your current APC version from your system:

apt-get remove --purge php-apcCode language: JavaScript (javascript)

2. Download the source code

An optional step here would be to download it here:

cd /usr/local/src/

Now proceed:

tar zxf APC-3.1.9.tgz
cd APC-3.1.9Code language: JavaScript (javascript)

3. Run phpize

It might not be installed in your system, if so install phpize:

sudo apt-get install php5-devCode language: JavaScript (javascript)

Now run the command:


4. Run the configure script

This command might change from one system to an other, make sure the php-config path is correct by running:

whereis php-config

Now run or change the following command according to the previous result:

./configure --with-php-config=/usr/bin/php-configCode language: JavaScript (javascript)

5. Compile and install the files

make install

If it happens to return errors try installing the following package and running the commands again:

apt-get install libpcre3-devCode language: JavaScript (javascript)

6. Edit your php.ini

The location of the file might be different, mine is:

nano /etc/php5/apache2/php.ini

Add the following line and save the file:

extension=""Code language: JavaScript (javascript)

7. Restart apache and test

Restart the apache:

sudo /etc/init.d/apache2 restart

Create a php file in your site with the following content and look for "APC" in it:

<?php phpinfo(); ?>Code language: HTML, XML (xml)


Leave a Reply

Your email address will not be published. Required fields are marked *