Web Server Performance: Installing eAccelerator

eAccelerator is a free, open source PHP accelerator, optimizer, and dynamic content cache, used to improve web server performance. It is a great tool which does not require change is existing php code. It stores PHP files in compiled state in shared memory and on next request it serves the request from compiled state cache. This saves a lot of parsing, compilation and I/O time.

Performance Impact on Web Server
eAccelerator can increase web application performance 1 – 10 times. It reduces the processor load and fasten the execution of php scripts.

Installing eAccelerator
First download and extract using following commands
wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.tar.bz2
Extract the tar file
tar xjf eaccelerator-0.9.5.2.tar.bz2
cd eaccelerator-0.9.5.2

Now we have to compile it
hpize ./configure –-prefix=/path/where/to/install
make
make install

now edit PHP Configuration (php.ini). Mostly found at /etc/php.ini
vi /etc/php.ini
Add following lines in php.ini
extension="eaccelerator.so"
eaccelerator.shm_size="0"
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"

Now create a temp directory which will used to store the compiled files and also set permissions to write.
mkdir -p /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator

finally restart Apache.
/etc/init.d/httpd restart

Your site should be lighting fast, remember faster sites create happy customers. Please note that you need to change version, paths according to your server.

This post is part of our “Web Server Performance” series. In this post we have discussed using eAccelerator for web server performance. You can find details about more PHP accelerators in {post link}

Leave a Reply