Installing eAccelerator for PHP5 on Debian Lenny (5.04)

 

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.

Share this on:

More helpful Articles

Download PDFDownload PDF

Tags:

9 Responses to “Installing eAccelerator for PHP5 on Debian Lenny (5.04)”

  1. reader says:
    Firefox 3.7a5pre Firefox 3.7a5pre Ubuntu 10.10 x64 Ubuntu 10.10 x64
    Mozilla/5.0 (X11; U; Linux x86_64; de-DE; rv:1.9.3a5pre) Ubuntu/10.10 (Maverick Meerkat) Gecko/20100509 Firefox/3.7a5pre

    thank you

    View CommentView Comment
  2. reader eddie says:
    Internet Explorer 8.0 Internet Explorer 8.0 Windows Vista x64 Edition Windows Vista x64 Edition
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)

    Thanks –

    Isn’t the line
    “server# /etc/init.d” after
    server# apache2ctl -t
    an error? It doesn’t make sense and produces an error – and the following line – “server# /etc/init.d/apache2” doesn’t it need “restart” after it?

    I appreciate your help.

    Also – I had big problems with the command phpize – and finally looked at the files on my Debian Lenny server and php5ize is probably the better command.

    Lastly – any help on getting the web interface to the eaccelerator installed?

    Thank you again.

    Eddie

    View CommentView Comment
    • admin says:
      Epiphany 2.29.92 Epiphany 2.29.92 Debian GNU/Linux x64 Debian GNU/Linux x64
      Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.29.92

      Yes you’re absolutely write I haven’t noticed the minor error. It’s fixed now. I will look forward in getting the eaccelerator web interface up and running soon and will inform you if I succeed.

      Wish you best!

      View CommentView Comment
  3. reader eddie says:
    Internet Explorer 8.0 Internet Explorer 8.0 Windows Vista x64 Edition Windows Vista x64 Edition
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)

    One last comment , question – on my server Debian 5 Lenny with ISPConfig and Apache2 … I have 3 php.ini files – /apache2/ , /cgi/ and /cli/ – I am not an expert, but this server is supposed to be running fast cgi – so I added the 9 lines of code the the php.ini files in /etc/php5/apache2/ and in /etc/php5/cgi/ and still when doing a php -v check at the server root, I received no indication that eaccelerator was installed and running – so I added the p eaccelerator config lines to the /etc/php5/cli/php.ini file and then it showed up – something about suhosin – and i don’t really understand this. To serve openx ads as fast as possible – with a celeron 1.2 Ghz 32 bit CPU with 512 MB of ram and a network file on a shared hard disk – i need every little bit of acceleration… do all 3 php.ini files come into play – and do they all 3 know where to find eaccelerator – or did I install eaccelerator (following your directions) only for one of them?

    Thanks again for your help,

    Eddie

    View CommentView Comment
    • admin says:
      Epiphany 2.29.92 Epiphany 2.29.92 Debian GNU/Linux x64 Debian GNU/Linux x64
      Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.29.92

      Hi Eddie,
      I’m glad I was able to help.

      Now let me answer your question.
      1. Yes you will have to add the eaccelerator load directives to all of your php.ini files, though I don’t see it as a necessity to add it to the cli php.ini. The cgi php.ini which you mention about is actually a php.ini which is used with fast cgi. So if you want eaccelerator for fastcgi then be sure to include the lines there. The other location /etc/php5/apache2/php.ini is actually the php.ini conf file for your “normal” php library directly loaded into Apache.

      That’s the best way I can answer your question. However if I can further help it will be my pleasure 🙂

      Wish you best!

      Georgi

      View CommentView Comment
  4. reader eddie says:
    Internet Explorer 8.0 Internet Explorer 8.0 Windows Vista x64 Edition Windows Vista x64 Edition
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)

    Thanks again – I found out how to add the control panel – pretty easy:

    Control panel

    eAccelerator provides a “control panel” of sorts that is useful to
    see what pages are being cached and usage of shared memory. To install
    the control panel, first copy file control.php into the web server
    document root:
    # cd /usr/local/src/eaccelerator-0.9.6.1
    # cp control.php /var/www
    Edit control.php to change the $user and $pw settings to a user name and password of your choosing.
    Don’t leave them as the default or attackers will be able to disrupt the cache.
    View the control panel at http://your-server-url/control.php
    Note: if you rename or move control.php you must update the eaccelerator

    Thanks again,

    Eddie

    View CommentView Comment
  5. reader eddie says:
    Internet Explorer 8.0 Internet Explorer 8.0 Windows Vista x64 Edition Windows Vista x64 Edition
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)

    ANd of course I add the following 2 lines to each if the php.ini files:

    zend_extension=”/usr/lib/php5/20060613+lfs/eaccelerator”
    eaccelerator.allowed_admin_path =”/var/www/control.php”

    that works for me.

    Thanks again

    Eddie

    View CommentView Comment
  6. admin says:
    Epiphany 2.29.92 Epiphany 2.29.92 Debian GNU/Linux x64 Debian GNU/Linux x64
    Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.29.92

    Thanks Eddie!
    The eaccelerator control panel install you suggest is quite nice.
    I’m gonna it a try myself as soon as a bit laters and would probably comment on my install 🙂

    View CommentView Comment
  7. sadotmd says:
    Firefox 3.6.3 Firefox 3.6.3 Ubuntu 10.04 Ubuntu 10.04
    Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3

    Worked! Thanks

    View CommentView Comment

Leave a Reply

CommentLuv badge