How do I install APC Advanced php caching on my linux server?


Important Notes:
APC is a PHP module that creates a cache for PHP files called by Apache.  You will want to install APC if you are having the following issues:
  1. Your server has Fedora Core 7 or Centos 5.x or above and at least PHP 5.1.6
  2. You have a PHP/MySQL driven page
  3. You are experiencing performance lag and have already done performance tuning of MySQL
Getting Started:
  1. Log into your server using SSH

  2. Once you have connected to the server you are going to run the following commands:



    [root@hostname]#yum install php-pear

    [root@hostname]#yum install php-devel

    [root@hostname]#yum install httpd-devel

    [root@hostname]#pecl install apc
  3. Now APC is installed, we just need to enable it on the domain(s) that require APC.  To do this, we need to copy apc.php from /usr/share/php/ to the httpdocs directory of the domain that needs APC.  Use the following command:

    [root@hostname]#cp /usr/share/php/apc.php /var/www/vhosts/DOMAINNAME.COM/httpdocs
  4. Now we need to create a file so PHP knows that APC is installed.  Issue the following command:

    [root@hostname]#vi /etc/php.d/apc.ini

    then insert the following line into the text document:

    extension=apc.so
  5. You will now need to restart the web server with the following command:

    [root@hostname]#/usr/local/psa/admin/bin/websrvmng -av
  6. Finally, you need to copy the file to the root of the domain that requires APC:

    [root@hostname]#cp /usr/share/php/apc.php /var/www/vhosts/DOMAINNAME.COM/httpdocs
  7. You can now test to see if APC is installed by going to http://DOMAINNAME.COM/apc.php

This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit www.codero.comchat with us online or give us a call at 866-2-CODERO.
Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)