Posts Tagged ‘Installing eAccelerator for PHP5 on Debian Lenny (5.04)’

Installing eAccelerator for PHP5 on Debian Lenny (5.04)

Wednesday, February 17th, 2010

 

Here is a quick way step by step instructions on installing Eaccelerator (the PHP the accelerator & optimizer).

1. Add the following lines to /etc/apt/sources.list:

deb http://debian.mcmillan.net.nz/debian lenny awm deb-src http://debian.mcmillan.net.nz/debian lenny awm
deb http://debian.schnuckelig.eu/ lenny main contrib non-free

2. Import the repository keys to prevent missing gpg key warnings.

server:~# gpg –keyserver keyring.debian.org –recv-keys 0x8f068012;
server:~# gpg –export –armor 0x8f068012 | apt-key add –
server:~# wget -O – http://debian.schnuckelig.eu/repository-key.gpg | apt-key add –

3. Install the eaccelearor from the debian repository

server:~ # apt-get update
server:~# apt-get install php5-eaccelerator

An alternative way for installation is the canonical way from source:

 

 

Eventhough installing eaccelerator from this Debian repositories sounds like a good idea I don’t want to risk using unofficial Debian repositories.
Therefore I decided to install it personally that way to prevent some possible security threats.

Here is once again a step by step installing walk through:

1. Install some packages required for compilation of eAccelerator on Debian platform.

server:~ # apt-get install build-essential php5-dev bzip2

2. Download, compile and install from source eaccelerator as a PHP5 module

server:~# cd /usr/local/src server
server:~# wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
server:~# tar xvfj eaccelerator-0.9.5.3.tar.bz2 server # cd eaccelerator-0.9.5.3 server
server:~# phpize
server:~# ./configure
server:~# make
server:~# make install

3. Create eaccelerator disk cache directory server

server:~# mkdir -p /var/cache/eaccelerator
server:~# chmod 0777 /var/cache/eaccelerator

4. Edit php.ini to enable eaccelerator module in PHP

Put the following after the last line in php.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″

Nevertheless, which way to install is used after the eaccelerator installation is compileted it is necessery to restart apache in order to load the new php.ini settings in the php module; So we now, let’s check apache for errors in configurations and restart it:

server:~# /usr/sbin/apache2ctl -t
Syntax OK

server# /etc/init.d/apache2 restart Now try your apache with some apache benchmarking tool to check about performance of php execution in apache.
See for yourself how eacceleator makes PHP script execution a way faster.