The Alternative PHP Cache (APC) can be used to increase the performance of your PHP applications. The APC is a free, open source cache system for PHP. The main aim of this project is to provide the robust and scalable framework of caching in PHP. It also provides the module for storing the application in cache.
In this tutorial I will explain you how you can download and install the Alternative PHP Cache framework on your PHP installation. You will learn how to enable this in PHP configuration file?
Alternative PHP Cache installation
There are two way to install the APC.
Here are the detailed description of both ways of installation.
From Repository of PHP distribution
On the Debian and Ubuntu APC can be downloaded from its main repository. You can check it through following command:
[email protected]:~# apt-cache search apc php php-apc - APC (Alternative PHP Cache) module for PHP 5
You can install APC using the following command:
sudo aptitude install php-apc
If you are using the Red Hat Enterprise, Centos or Fedora you can use this command to install the APC module:
sudo yum install php-pecl-apc
Installing With the help of PECL
Now we will learn how to install using the PECL. You can install APC using following command:
$ sudo apt-get install php-pear php5-dev apache2-threaded-dev build-essential $ sudo pecl install apc
To configure the APC module you should add following line in php.ini file:
Now restart the apache server. Now you can use the following code in PHP file and test the APC module:
<?php phpinfo(); ?>
More PHP Tutorials