How to install and configure APC Cache on a CentOS server?

APC cache is a PHP caching solution which stands for Alternative PHP Cache. It serves PHP pages from a cache thus helping to reduce server load. APC is an open source software and is updated from time to time.

The following are the steps to install APC cache on a cPanel / Plesk OR even on a plan CentOS server:

1) SSH to your server and go to a temporary directory

# cd /usr/local/src

2) Download the latest APC version

# wget

3) Unpack the version and change to the APC directory

# tar -zxf APC-3.1.6.tgz 
# cd APC-*

4) Create configuration files

# phpize

5) Search for the “php-config” file since you need to configure APC with it

# which php-config

6) Now, configure APC

# ./configure --enable-apc --enable-apc-mmap --with-apxs\

7) Create the installation files and install APC

# make 
# make install

Now that the APC cache is installed on your server, the final step is to activate the APC extension in the php.ini file.

Locate the working php.ini file of your server

# php -i | grep php.ini

edit the file and search for “extension_dir” and place the following code below it (tweak the values as per your requirement):


Restart the Apache web server  for changes to take affect. To confirm if APC is activated, execute

# php -i | grep apc

Note: once APC is installed, make sure the ‘’ file is created under the directory specified at the “extension_dir” in php.ini. If not, look for the exact path of the file and create a symlink under it.

This entry was posted on Saturday, December 18th, 2010 and is filed under Installations. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

5 Responses to “How to install and configure APC Cache on a CentOS server?”

  1. André


    I’m trying to update my APC version to 3.1.6, but all I did not work.
    My actual version is 3.0.19.

    How can I do to update that?

  2. admin

    Hi Andre, You need to download the latest version i.e. 3.1.6 and install it with the steps provided above. To avoid any confusion, remove the older version first by going to the APC directory and executing,

    phpize clean
    make clean

  3. André


    Thank you for reply me!
    Could you explain to me how can I do it?
    Step by step?

    For example: How do I need to go into APC directory?
    Is just writing: cd APC-*

    I’m sorry, but I don’t have much knowedge about ssh and apc.

    Again, thank you!!

  4. André


    I tried to do all steps you tell me.
    But it does not work.

    Have any mode to auto update via ssh?
    Any code to use?

    Thank you!

  5. admin

    Andre, you need to perform the steps I have given you in the previous comment first before installing the latest version. The 2 steps forwarded above has to be executed in the older version APC directory you downloaded. If you wish, you can contact me over MSN or via email and I will help you out.