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)
before you run
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
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
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 Olaf Lederer.
4 thoughts on “How-to install eAccelerator?”
Today I noticed that the download URL doesn’t work. Use the SF url instead:
The download from sourceforge is a zip file, you need to install “unzip” first:
apt-get install zip(unzip is installed automatically)
unzip eaccelerator-0.9.6.1.zipto extra the zip archive
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
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
Comments are closed.