How To Install APC cache

[Total: 3    Average: 5/5]

How To Install APC cache

APC (Alternate PHP Cache) is a op-code caching for PHP. Once PHP code is run, APC caches the complied PHP code so for next time, time for compiling PHP will be reduce and gives faster performance.

In this article we are going to intall APC cache on centos.

Install Dependency Packages for APC

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

pecl install apc

Configuring APC :

Open a file with your favurate editor /etc/php.d/apc.ini and change as below

vi /etc/php.d/apc.ini
extension=apc.so
apc.enabled=1
apc.shm_size=1024M

Restart Apache Service for APC

/etc/init.d/httpd restart

Create phpinfo in Apache web diretory like follows and make sure APC enabled.

echo -e "" > /var/www/html/phpinfo.php

Browse the phpinfo file. You will see APC enabled configuration similar to below.

How To Install APC cache

Enable PHP APC administration

vi /usr/share/php-pecl-apc/apc.php

Now set the username and password in the file apc.php as shown below.

defaults('ADMIN_USERNAME','apc');
defaults('ADMIN_PASSWORD','adminpassword');
/etc/init.d/httpd restart

Access to “http://(hostname or IP address)/apc/apc.php” with Web browser. You will see similar as below.
How To Install APC cache