How to install APC (Alternative PHP Cache) on a RHEL / Fedora Linux system.

You can install it automatically from the repository (if available)

yum install php-pecl-apc
service httpd restart

Or build it manually :

Install some prerequisite

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

Download and inflate the latest release of APC

cd /usr/local/src
tar xzvf APC-3.1.9.tgz
cd APC-3.1.9

Compil and install APC (warning on PHP_APC_GCC_ATOMICS are ok for me)

./configure --enable-apc
make install

Add the folowing configuration at the end of php.ini

vi /etc/php.ini
[APC : Alternative PHP Cache]
extension =
apc.shm_size = "256M"
apc.stat = 1
apc.enabled = 1
apc.enable_cli = 1

Set approriate rights, SELinux context and restart Apache

cp /usr/local/src/APC-3.1.9/apc.php /var/www/html/apc.php
chown root:apache /var/www/html/apc.php
chmod g+r-xw /var/www/html/apc.php
chcon --reference /var/www/html/ /var/www/html/apc.php
service httpd restart

Now you can test : http://localhost/apc.php

Interface d'administration d'APC