User Tools

Site Tools


PHP Accelerators

PHP Accelerators can improve the PHP performance: PHP sites are “precompiled” and served directly from the cache.

APC (Alternative PHP Cache)

APC (Alternative PHP Cache) is a free and open opcode cache for PHP. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.

Installing with yum (RedHat ES 5)

yum install php-pear

But, this will not run on its own, we need the following package for the phpize command:

yum install php-devel

We also need the apxs command, which is installed via the following package:

yum install httpd-devel

Now we have all the software we need, so we install apc via the pecl command:

pecl install apc

Once that finishes, we need to enable apc in Apache's configuration. the following command should do this for us.

echo "" > /etc/php.d/apc.ini

Then we restart Apache:

service httpd restart

Installing APC from source

Download the source

Download the source from the repository and extract it:

tar xzfv <package name>
cd <package name>

Compile APC

Make sure the binary is in the extensions folder of php after the compile process. The extensions location is found in /etc/php.ini.

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

Configure PHP for APC

Create a new PHP configuration under /etc/php.d/apc.ini with the following content:


See Alternative PHP Cache (APC) documentation for configuration details.

Reboot Apache

service httpd restart

Check that apc is working

Check your php installation: You should find a section in phpinfo() about APC:

php -i | grep apc

APC Web Interface

If you download the apc source files, there is also a file named apc.php included. To have a graphical access to the apc configuration and statistics copy this to an php enabled virtual host.

apc web interface

Disable APC

Sometimes APC causes problems with web applications and APC has to be disabled completely.

  1. open /etc/php.d/apc.ini (vim /etc/php.d/apc.ini)
  2. set apc.enabled to 0 (apc.enabled=0)
  3. restart apache (service httpd restart)


Installation and Configuration

  • Download rpm or source file from
  • phpize and make after extracting the source:
  • Install eAccelerator
    make install
  • Create the cache folder
    cd /tmp
    mkdir /var/cache/eaccelerator
    chmod 777 /var/cache/eaccelerator
  • Adapt the eaccelerator.ini file to your needs and copy it to /etc/php.d/
    cp eaccelerator.ini /etc/php.d/eaccelerator.ini
  • Restart Apache in order to activate eAccelerator
    service httpd restart
  • Check if eaccelerator is successfully installed
     php -v
    PHP 5.1.6 (cli) (built: Jul 16 2008 19:53:00)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
        with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Configuring the web control panel

  1. copy the file control.php from the source to you web root
  2. set username and password within the control.php file
  3. set the path to the control.php file within the eaccelerator.ini file (eaccelerator.allowed_admin_path)

The resulting web page should like the following example:

eaccelerator control panel

/srv/ · Last modified: 2009/08/15 19:05 (external edit)