Installing Alternative PHP Cache (APC) on Server

Let’s see how to installing APC on your Virtual Private Server

The APC-Alternative PHP Cache is a free, open, and robust framework which is responsible for caching and optimization of the PHP.

Following are steps to Install APC on your web server

Step 1 – You must be logged in as root to proceed with installing APC on your server

Step 2 – You must then download the APC

wget http://pecl.php.net/package/APC

eg : wget http://pecl.php.net/get/APC-3.0.15.tgz

Step 3 – Having done that, you are then required to extract it over your Web Hosting UK server:

tar -xzf APC-3.0.15.tgz

cd APC*

Step 4 – Look for the PHP location by running the below command :

which php

You must remember the location displayed in the result.

Step 5 – Now you need to proceed with creating the configuration files using the below command :

phpize

Step 6 – Now the APC need to be compiled over the server :

./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
make
make install

Note : You must install the APC in the php.ini file

Step 7 – Run the below command to find the php.ini over the server :

php -i | grep php.ini

Step 8 – Amend php.ini by adding APC extension, as stated below :

vi /usr/local/Zend/etc/php.ini

Step 9 – Add the following to the php.ini file :

apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1

Step 10 – Finally, you must restart Apache using the below command :

service httpd restart

If you need any help regrading these , please feel free to contact our technical support department via. 24×7 Live Chat or raise a ticket through our helpdesk.