How to install APC on Centos

APC is one of the fastest and stable memory cache component for your web server. If you have only one server that serves everything then APC is a good choice.

Here is how to install APC:

Install necessary components

yum install php-devel php-pear httpd-devel gcc make
yum install pcre pcre-devel

Install APC

pecl install apc

Configure APC

You should check more config settings for your APC

Enable per request file info about files used from the APC cache [no] : no
Enable spin locks (EXPERIMENTAL) [no] : yes
Enable memory protection (EXPERIMENTAL) [no] : yes
Enable pthread mutexes (default) [no] : yes
Enable pthread read/write locks (EXPERIMENTAL) [yes] : yes
Add apc extension to PHP

echo "" > /etc/php.d/apc.ini

Remember: Restart your web server (Apache or Nginx,…)

Create a PHP Info file to see APC installed or not

vi /path-to-your-web-root/phpinfo.php

Add phpinfo

Visit your phpinfo.php to check APC extension.

Happy coding!