APC is used for php caching.
There are two main ways you can install APC. This guide will show you how to do both eventually. To start off I will show you how to install using Pecl. Pecl installs the latest version of APC. This install should normally be fine however sometimes it may not be very useful if your php version is different to the requirements for the latest version of APC.
This guide will go through the installation for both Apache and Nginx, the only difference is that PHP-FPM will need to be restarted for nginx.
Quick Links:
Installing APC
apc.ini Configuration
APC Administration
Upgrading APC
Uninstall APC
Installation
yum install php-pear php-devel httpd-devel pcre-devel gcc make
pecl install apc
apc.ini configuration
Installing APC using Pecl will NOT create an apc.ini file, this will have to be created to enable the php module. You should create the file /etc/php.d/apc.ini and then enter the following information into the file:
extension=apc.so
Once you have done this you should test to see if the php module has been correctly installed with:
php -m | grep apc
Restart php-fpm if you are using Nginx and your done.
PHP APC Administration
The current configuration file for apc can be found at: /usr/share/pear/apc.php we then need to copy this file to the root directory of you webserver, for example I will place the apc.php file in my directory for this domain.
cp /usr/share/pear/apc.php /var/www/html/LukesLinuxLessons
You should then edit /var/www/html/apc.php and change the username and password in the file so secure the admin panel, this section should look like:
defaults('ADMIN_USERNAME','apc'); // Admin Username defaults('ADMIN_PASSWORD','Set-Password-Here'); // Admin Password - CHANGE THIS TO ENABLE!!!
You should then visit: http://localhost/apc.php and replace localhost with the ip address or domain that the file is located in e.g lukeslinuxlessons.co.uk/apc.php
Upgrade APC
pecl upgrade apc
Uninstall APC
pecl uninstall apc