How to install APC Cache (Latest Version) In 10 Steps

If you’re unable to get xCache working, or are looking for other PHP caching solutions on your server to help reduce the load, APC cache is a great alternative. APC stands for Alternative PHP Cache and has been around for a long time, and now supports PHP 5.3 in its latest version we’re about to install.  APC is an open source cache alternative, and gets it’s updates from a handful of dedicated developers.

Simply follow along to get a good clean install of the latest APC version. All of these commands are run from SSH as the root or super user.

[sourcecode language=”bash”]
# cd /usr/src
# wget
# gzip -d APC-*
# tar -xf APC-*
# cd APC-*
# which php
# phpize
# ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
# make
#make install

Line 1. Changes you to the /usr/src directory. {optional}
Line 2. Gets the latest APC version
Line 3. Unpacks the version
Line 4. Unpacks the download
Line 5. Moves you to the APC folder
Line 6. Lets you know where PHP is, should be something like ‘/usr/local/bin/php’
Line 7. Creates configuration files
Line 8. Configures APC cache with the predefined options
Line 9. Makes the install files
Line 10. Installs APC to your system

Lastly we need to edit the php.ini file

[sourcecode language=”bash”]
# locate php.ini
# nano /location/of/php.ini

Search for ‘extension_dir’ and below that place

[sourcecode language=”bash”]

Finally restart apache
[sourcecode language=”bash”]
# service httpd restart

Alternative PHP Cache (APC) is now installed to your system. You can tweak the settings by editing the lines above in your php.ini file. (Don’t forget to restart every time). If you want to check if APC is working, simply create a php info page, and look for the section on APC. There is also an “apc.php” file inside your /usr/src/APC-* folder, you can move to a public location and view it from the internet for stats.

One thought on “How to install APC Cache (Latest Version) In 10 Steps

  1. This guide worked perfectly for me on a cPanel server. I couldn’t get the xCache one to work for some reason, so thanks for the guide.

Leave a Reply

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