High Performance/Traffic PHP WebServer – PHP Caching (eaccelerator)

High Performance/Traffic PHP WebServer – PHP Caching (eaccelerator)

eAccelerator is a PHP caching system, which caches frequently used portions of PHP files to RAM to increase performance. This is especially great on high traffic websites such as forums. Performance gains of up to 1000% have been seen with eAccelerator. The following tutorial shows how to install eAccelerator from source on Linux.

Download the source:

cd /usr/src/
wget http://internap.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0.9.3.tar.gz
tar zxvf eaccelerator-0.9.3.tar.gz
cd eaccelerator-0.9.3

Build:

export PHP_PREFIX=”/usr”
$PHP_PREFIX/bin/phpize
./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
make

Note, the PHP_PREFIX should be set to where you have PHP installed.

Install:

make install

If you are using Zend, add the following to your php.ini file:

zend_extension=”/usr/local/lib/php/extensions/no-debug-non-zts-20020429/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″

Note: zend_extension should be equal to the location to where the extension was installed.

If you are not using Zend, you can load eAccelerator as a PHP extension:

extension=”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″

Setup caching directories:

mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator

You can copy the eaccelerator.php file to a web accessible location, and check if eAccelerator is running.

Similar Articles : High Performance PHP – Installing eAccelerator on FreeBSD, High Performance/Traffic PHP WebServer – PHP Caching (eaccelerator)