Accelerating PHP with eAccelerator

eAccelerator is a further development from mmcache PHP Accelerator & Encoder. It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated.

  • Prior to installing check that php-devel package is installed.
  • Download via
  • Run the below commands to compile and configure:
      # export PHP_PREFIX="/usr"
      # $PHP_PREFIX/bin/phpize
      # ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
      # make

    You must specify the real prefix where PHP is installed in the "export" command. It may be "/usr", "/usr/local", or something else. You can find out by running `which phpize`.

    If you get - "You should update your 'aclocal.m4' by running aclocal." when you run phpize, then you should run `aclocal`.

  • Run `make install` to install the application.
  • The "" shared extension gets installed in /usr/lib/php4 directory.
  • Copy the "eaccelerator.ini" to the "/etc/php.d" directory and modify the default values as needed.
  • If php has not been configured with "--with-config-file-scan-dir=/etc/php.d" then you will be missing the "/etc/php.d" directory. In which case copy the contents of the "eaccelerator.ini" to "/etc/php.ini".
  • Create the cache directory and change the owner to the user that apache runs as:
       # mkdir /tmp/eaccelerator
       # chown apache /tmp/eaccelerator
       # chmod 0700 /tmp/eaccelerator
  • eAccelerator can be managed through web interface script eaccelerator.php. Copy the eaccelerator.php and eaccelerator_password.php file in the eaccelerator directory to a directory that is web-accessible. For security reasons it is recommended to restrict the usage of this script by your local IP.
  • Before you can access the eaccelerator.php page, you will need to create the eAccelerator admin username and password for it:
      # php -q eaccelerator_password.php

    Add the given output admin name and password to the "/etc/php.d/eaccelerator.ini" file.

  • Restart Apache.
  • Verify installation is working by cheking with a phpinfo file. The contents of the phpinfo file should show similar information mentioning eAccelerator:
      This program makes use of the Zend Scripting Language Engine:
    Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies with eAccelerator v0.9.2, 
    Copyright (c) 2004-2005 eAccelerator, by eAccelerator

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

easy install via dags/rpmforge repo

Easiest install would be to use dags/rpmforge repo.

Install via:

# yum install php-eaccelerator

aclocal: command not found

If you get the below error on running phpize:

aclocal: command not found

You need to install automake via:

# yum install automake

Cannot find autoconf

The autoconf package is needed if you get the below error while running `$PHP_PREFIX/bin/phpize`:

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.

Installation via:

# yum install autoconf


Recently updated eaccelerator to 0.9.5, everything seems to be the same with the installation steps mentioned above, except that you now specify the "allowed_admin_path" for scripts that you allow to get admin information and do admin controls in the "/etc/php.d/eaccelerator.ini" file.

eaccelerator.allowed_admin_path = "/var/www/html/control.php"

Once that is set, you can copy the "control.php" file to your webroot and access the admin control page to get detail information. Make sure to change the default admin user and password in the "control.php" file.

Also note: every time php is updated, eaccelerator need to be re-compiled and installed.

Blog linked from zoeloelip

A trackback to the eAccelerator project contributor - !


I did some eAccelerator benchmarks, and was quite impressed. You can view the results at Programmin' Prim8.

shm_size > maximum size of a shared segment

Can the shm_size setting be greater than the maximum size of a shared memory segment?

In my system (redhat) that value is 32 MB

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1


Can I set shm_size to 64 MB no prob?

multiple shm-segments

Yes, it will get multiple shm-segments if it does not fit in one shared memory segment.