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 http://pecl.php.net/package/apc 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-apc
2. Download the source code
An optional step here would be to download it here:
wget http://pecl.php.net/get/APC-3.1.9.tgz tar zxf APC-3.1.9.tgz cd APC-3.1.9
3. Run phpize
It might not be installed in your system, if so install phpize:
sudo apt-get install php5-dev
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:
Now run or change the following command according to the previous result:
5. Compile and install the files
make make install
If it happens to return errors try installing the following package and running the commands again:
apt-get install libpcre3-dev
6. Edit your php.ini
The location of the file might be different, mine is:
Add the following line and save the file:
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: