Linux > Virtualization

Installing Alternative PHP Cache (APC) on Server

(1/1)

sajugovind:
Installing APC on your Virtual Private Server

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

Steps to Install APC on your web server:

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

Step ii – You must then download the APC

   
--- Code: --- wget http://pecl.php.net/package/APC
--- End code ---

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

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

 
--- Code: ---   tar -xzf APC-3.0.15.tgz

    cd APC*
--- End code ---

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

   
--- Code: ---which php

--- End code ---
You must remember the location displayed in the result.

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


--- Code: ---    phpize
--- End code ---

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

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

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

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

   
--- Code: ---php -i | grep php.ini
--- End code ---

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

   
--- Code: --- vi /usr/local/Zend/etc/php.ini
--- End code ---

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

   
--- Code: ---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
--- End code ---

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

   
--- Code: --- service httpd restart
--- End code ---

Thank you,

Navigation

[0] Message Index

Go to full version