Install and Integrate eAccelerator into PHP5 on Debian Squeeze

Valic —  June 18, 2011 — 2 Comments

eAccelerator is a free open-source PHP accelerator & optimizer. 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.

eAccelerator stores compiled PHP scripts in shared memory and executes code directly from it. It creates locks only for a short time, while searching for a compiled PHP script in the cache, so one script can be executed simultaneously by several engines. Files that can’t fit in shared memory are cached on disk only.

The latest release, 0.9.6.1, features support for PHP 5.3 and also works with PHP 5.1 and 5.2.

1. Installation:

apt-get update && apt-get upgrade && apt-get install php5-dev

Now  you  have to download and install eAccelerator from the eAccelerator website.

Now Install eAccelerator using the following commands:

cd /usr/src
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar -xvfj eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
phpize
./configure
make
make install

2. Integrate eAccelerator in PHP5:


In Debian Squeeze the configuration files for the PHP 5 modules are stored in the /etc/php5/conf.d directory.

Create eaccelerator.ini file :

cd /etc/php5/conf.d/
touch eaccelerator.ini

Now ddd the following lines to /etc/php5/conf.d/eaccelerator.ini:

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

Now create the /var/cache/eaccelerator directory and make it writable:

mkdir -p /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator

3. Restart apache2:

/etc/init.d/apache2  restart

NOTE: Create one file named phpinfo.php and put the following content in it:

Open phpinfo.php file  in your browser. Now search for eAccelerator module.
You should now see eAccelerator mentioned on the page which means it has successfully been integrated and is working as expected.

You can also check if you can check if eAccelerator is running by executing:

php -v

When eAccelerator is loaded successfully you will see something like:

PHP 5.3.3-7+squeeze1 with Suhosin-Patch (cli) (built: Mar 18 2011 17:22:52)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

2 responses to Install and Integrate eAccelerator into PHP5 on Debian Squeeze

  1. WOW, great website, great articles, thanks

    -Steve

  2. SerInformaticos October 10, 2011 at 08:55

    Thanks!

Leave a Reply