PHP 5 eAccelerator

September 18th, 2007
No Gravatar

This is a mini howto on installing eAccelerator.

eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.

Summary: Makes your PHP faster.

If you run Ubuntu like me, you’ll need to install autoconf first.

apt-get install autoconf

Firsly download the source code from the eAccelerator homepage.
Installation is mega easy,

unzip eaccelerator-0.9.5.2.zip
cd eaccelerator-0.9.5.2
phpize
./configure
make
make install

The documentation suggests you add the following to your php.ini file (I’ve modified the first line).

zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/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"

Next we need to create the cache directory

mkdir /tmp/eaccelerator
hmod 0777 /tmp/eaccelerator

Finally, restart apache and check it works.

php -v

It should return something like this
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo


Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Geekery, Linux category.

Leave a Reply