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

Advertisement

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

Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement