Home > Misc. Tutorial Logs > How-to install eAccelerator?

How-to install eAccelerator?

January 30, 2011 5 Comments »

Tags: cache cent-os eaccelerator php ubuntu

I’m using eAccelerator on two servers now, for both I’m using DirectAdmin as control panel. One is based on Ubuntu and the other one is running on Cent-OS.

Download eAccelerator from their website and follow their instructions (you need root access to install eAccelerator and it’s required to install php5-dev tools first):

wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar xjvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make

The “–with-php-config” setting is maybe not necessary, check your server for the right location.

It might be possible that you need to install the PHP dev tools first (yum install php-devel (Cent-OS or apt-get install php-dev)

Run ALWAYS

make test

before you run

make install

If you get a message like

[eAccelerator] This build of “eAccelerator” was compiled for PHP version 5.2.14. Rebuild it for your PHP version (5.2.17) or download precompiled binaries.

you need to start over with

phpize --clean

If all warnings/messages after running the “make test” function are gone, continue:

Open the php.ini file (in my case: /usr/local/etc/php5/cgi/php.ini) and add the following settings at the end of the file:


zend_extension="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

The value for “zend_extension” might be different, check the location first (you get the right value after “make install” is done).

Next we need to create the cache directory:


mkdir /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator

Warning: 0777 permissions are for the lazy ones, you should use a less permitted level (if you can). This is the advice from the eAccelerator website:

A safer and cleaner way would be to change the owner of the directory to the same user PHP runs as (most of the time the same user as Apache or Lighttpd) and set 0644 permissions.

retstart the web server using
/ect/init.d/httpd restart

and your ready! Check your php configration using “phpinfo()” and check also the cache location for newly created directories.

Check the eAccelerator website for more information.

Written by .

Comments: 4

Leave my own
  1. admin Reply
    July 16, 2011 at 10:09 pm

    Today I noticed that the download URL doesn’t work. Use the SF url instead:


    http://sourceforge.net/projects/eaccelerator/file...

  2. Pete Reply
    September 9, 2011 at 8:24 pm

    The download from sourceforge is a zip file, you need to install “unzip” first:
    apt-get install zip (unzip is installed automatically)
    Then use
    unzip eaccelerator-0.9.6.1.zip to extra the zip archive

  3. finalwebsites Reply
    September 14, 2011 at 1:35 pm

    I noticed that file locations are very different for Ubuntu and CentOS.
    I use this command to find for example “phpize”
    $ sudo locate phpize

    It’s possible that you need to install “locate” first:
    $ sudo apt-get install locate

  4. Olaf Reply
    February 10, 2012 at 11:54 am

    If you update PHP5, don’t forget to re-compile “eAccelerator” or otherwise PHP will disable the extension.
    I’m running automatic updates on several Ubuntu based servers and I replaced “eAccelerator” with APC (Alternative PHP Cache). It’s much easier to install, the performance is great too and updates are done by APT. If you like to do the same follow these steps.
    1. remove the eAccelerator settings from the php.ini file
    2. reload the Apache service
    3. Remove the .so file (check the file location inside the php.ini file)
    4. remove the cache directory and eventually the installation files.
    5. Install APC with “apt-get install php-apc”.

    That’s all, I found this opcode cache performance comparision @stackoverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks:1

Listed below are links to weblogs that reference How-to install eAccelerator?

pingback from Why should you cache your PHP website? - 1st Digital Media October 23, 2014

[…] If you’re able to configure your web server (you need root access) you should try the eAccelerator project. It works as kind of PHP extension and is able to create a cache version of your PHP scripts. I installed and updated eAccelerator on two web servers now and I like it how it works. Before you start you should check the requirements and maybe you like to read my notes about the eAccelerator installation. […]