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

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

 
Install APC

1
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

1
echo "extension=apc.so" > /etc/php.d/apc.ini

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

Create a PHP Info file to see APC installed or not

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

 
Add phpinfo

Visit your phpinfo.php to check APC extension.

Happy coding!

坚持原创技术分享,您的支持将鼓励我继续创作!