Install PHP APC Cache on CentOS 7 using yum

To install APC cache on CentOS 7, run

yum install php-pecl-apcu

After that, you need to restart the Apache webserver.

systemctl restart httpd

in phpinfo() page, you will see

php APC cache in phpinfo

Files in the packages are

[root@localhost ~]# rpm -q --filesbypkg  php-pecl-apcu
php-pecl-apcu             /etc/php-zts.d/40-apcu.ini
php-pecl-apcu             /etc/php.d/40-apcu.ini
php-pecl-apcu             /usr/lib64/php-zts/modules/apcu.so
php-pecl-apcu             /usr/lib64/php/modules/apcu.so
php-pecl-apcu             /usr/share/doc/pecl/apcu
php-pecl-apcu             /usr/share/doc/pecl/apcu/NOTICE
php-pecl-apcu             /usr/share/doc/pecl/apcu/README.md
php-pecl-apcu             /usr/share/doc/pecl/apcu/TECHNOTES.txt
php-pecl-apcu             /usr/share/licenses/php-pecl-apcu-5.1.21
php-pecl-apcu             /usr/share/licenses/php-pecl-apcu-5.1.21/LICENSE
php-pecl-apcu             /var/lib/pear/pkgxml/php-pecl-apcu.xml
[root@localhost ~]# 

Config file located at

/etc/php.d/40-apcu.ini

Some configuration settings

apc.shm_size – default is 64M, it is better increase this value to 128M

apc.stat – default 1, set it to 0 to increase performance. Setting it to 0 means APC won’t look for code change. When you change code, you will need to restart web server.

apc.num_files_hint – Tell APC how many PHP files it needs to cache. Set it to 10000

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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