eAccelerator

1. What is eAccelerator?

eA is a free open source php optimisation software. It improves the speed of php scripts by intermediate storage in compiled state. Thereby the processor load as well as the speed of scripts can be increased 1-10 fold.

2. Installation

First and foremost we have to get the newest version from… at the time of writing it was 0.9.6.1. Also it is important to note that this was written for Debian Lenny

The php development packaged need to be installed in order to install phpize

apt-get install php5-dev
cd /usr/local/src/
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2

Now follows the unpacking of the archive.

tar -xjvf eaccelerator-0.9.6.1.tar.bz2
rm eaccelerator-0.9.6.1.tar.bz2

We now change into the directory of the unpacked archive.

cd eaccelerator-0.9.6.1

For further installation we will use a short variable.

export PHP_PREFIX="/usr"

2.1 Installation for php5

eA has to be specifically compiled for all PHP versions. Hence it is necessary to repeat these steps php5. Also, we have to note that when upgrading the php versions eA has to be newly compiled.

$PHP_PREFIX/bin/phpize5
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config5 --with-eaccelerator-doc-comment-inclusion

Now you’ll only have to copy the module into the php extension directory. It goes like this:

make install

In order to load the module we compose a configuration file:

vi /etc/php5/conf.d/eAccelerator.ini

This we fill in with the following content and save. Of course we will have to note that the variable ‘zend_extension’ is correctly put.

zend_extension="/usr/lib/php5/20060613/eaccelerator.so"
eaccelerator.shm_size="16"
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"

2.2 embedding in ispCP

generally eA deposits the compiled files in /tmp. IMO that is a bit insecure. For that reason we have set the directory to the /phptmp directory of the respective domain. We have to edit the following file:

/etc/ispcp/fcgi/parts/php5/php.ini

At the end of the file we add:

[eAccelerator]
eaccelerator.cache_dir = "{WWW_DIR}/{DMN_NAME}/phptmp"

Thus the cache directory is set to the respective root domain. An optimal solution would of course be to differentiate between subdomains and domain aliases, but that is impossible because there is only one php.ini for the main domain. Neither does insertion of php_admin_value lead to a positive result.

To finish you’ll have to regenerate the configuration. The necessary info you’ll find here:

http://isp-control.net/documentation/howto:ispcp:regenerate_config