CodeBlog.ch


Concrete5 – more Speed with eAccelerator

Posted in Concrete5 by Remo Laubacher on the June 12th, 2009

UPDATE: The latest eAccelerator version doens’t contain the PHP API anymore. It therefore does no longer work with Concrete5! The upcoming version 5.4 is going to have support for APC and memcache. Sorry!

You want more speed with Concrete5? Make sure you’re using eAccelerator!

In this tutorial I’ll explain how to install eAccelerator on a Debian Linux Server.

eaccelerator1

Already installed?

Create a page called info.php somehwere in a directory you can access using http://…

1
2
3
<?php
   phpinfo();
?>

Try to find “eAccelerator”. If you can’t find it, it’s not installed, go ahead with the following instructions.

Install eAccelerator

Open a console/ssh connection to your server and enter these commands:

wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xvfj eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
phpize
./configure --with-eaccelerator-shared-memory --with-php-config=/usr/bin/php-config --with-eaccelerator-userid=www-data --with-eaccelerator-content-caching 
make
make install

You might want to check whether 0.9.5.3 is still the latest version. As of the 12th of June 2009 it is.

Make sure there are no error messages before you continue.

Create the directory where you want to save the eAccelerator cache files:

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

Create the config file for eAccelerator. Use a vi or any other text editor to create the config file:

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

Enter this content:

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_ttl = "0"
eaccelerator.shm_max = "0"
eaccelerator.shm_prune_period = "0"
eaccelerator.shm_only = "0"
eaccelerator.compress = "1"
eaccelerator.compress_level = "9"

You can restart apache using this command now:

/etc/init.d/apache2 restart

Open the info.php again and check whether you can see eAccelerator. If everything looks fine, go to the directory of your Concrete5 and edit “config/site.php” – add this line:

define('CACHE_LIBRARY', 'eaccelerator');

Open your Concrete5 and feel the difference!

9 Responses to 'Concrete5 – more Speed with eAccelerator'

Subscribe to comments with RSS or TrackBack to 'Concrete5 – more Speed with eAccelerator'.

  1. michioga said,

    on June 16th, 2009 at 05:46:55

    Does not work for admin panel with such error.
    Fatal error: Call to undefined method Cache::disablecache() in /xxx/xxx/concrete/libraries/update.php on line 25
    My concrete5 is 5.3.1.


  2. on June 16th, 2009 at 07:20:44

    Yes, this seems to be a problem with vertain Versions of Concrete5. I’ve reported this bug here http://www.concrete5.org/community/bugs/method_disablecache_doesnand039t_exist

    Try removing “define(‘CACHE_LIBRARY’, ‘eaccelerator’);” until this has been fixed. Concrete5 won’t use eAccelerator to cache the internal objects, but eAccelerator will still improve the php performance overall.

  3. Sam said,

    on June 26th, 2009 at 01:33:33

    I was wondering if the same is written for the Zend Optimizer.

    define(‘CACHE_LIBRARY’, ‘eaccelerator’);

    There is also a problem with the Anti Spam word. It’s not showing the complete word and is cutting the last 3 letters off. I am using the latest version of firefox.

  4. Sam said,

    on June 26th, 2009 at 01:35:32

    Oops :)
    What I meant was does this:
    define(’CACHE_LIBRARY’, ‘eaccelerator’);
    become this:
    define(’CACHE_LIBRARY’, ‘zend’);


  5. on June 26th, 2009 at 07:39:53

    @Sam: No there’s no support for zend, but if it has a similar API (set and get objects) it quite easy to implement.. But since I’ve never worked with Zend, I can’t help you with it.

  6. mrS4ndm4n (Dom) said,

    on February 13th, 2010 at 02:08:54

    Hi Remo,

    dank Dir für diesen Tipp.. wir haben eAccelerator heute, entsprechend Deiner Anleitung, auf unseren Servern installiert und es hat Wunder bei Zugriffszeiten und Serverlast bewirkt..

    ..die Freude hat leider nicht lang angehalten, leider mussten wir feststellen dass sich das Dashboard nicht mehr öffnen lässt.. bei einer Seite kommt der beschriebene “Fatal error: Call to undefined method Cache::disablecache() in /xxx/xxx/concrete/libraries/update.php on line 25″ ..bei allen anderen lädt er einfach gar nichts..

    ..allerdings setzen wir keine SVN-Version ein, sondern die 5.3.3.1 stable..

    ..weisst Du ob es sich lohnt dem Fehler weiter auf den Grund zu gehen.. oder vertragen sich C5 und eAccelerator einfach doch nicht..?

    ..das wäre sehr schade, da es genau das ist was C5 noch fehlte, etwas mehr speed..

    Gruß

    dom


  7. on February 13th, 2010 at 09:56:25

    Sorry, ich hab das Tutorial aktualisiert. Das Problem ist, dass die Leute von eAccelerator in der aktuellsten Version die PHP API entfernt haben. Sie wollen so die Wartung verbessern – wird sicherlich helfen – allerdings kann man aus PHP Scripts nicht mehr auf den Cache von eAccelerator zugreifen. Das ist leider ein unglücklicher Zufall – Sorry!

    Die kommende Version von Concrete5 wird jedoch APC und memcache unterstützen. Bisher hab ich mit Single Server Seiten bei APC bessere Ergebnisse erzielt, hab meine Tests aber noch nicht abschliessen können.

  8. dom said,

    on March 1st, 2010 at 17:58:07

    ..ah ok.. dank Dir für den Tipp.. na dann werden wir uns doch auch mal APC und Memcache anschauen.. unsere Server beherbergen allerdings jeweils mehrere Seiten..


  9. on March 1st, 2010 at 18:04:25

    Mehrere Seiten auf einem Server ist ja kein Problem. Wenn du skalieren willst, würde ich jedoch memcache anschauen da du den auf einen zweiten Server verschieben könntest um ihn anschliessend von mehr als einem Webserver anzusprechen.
    Bei meinen Tests hab ich jedoch die besseren Ergebnisse mit APC erreicht, konnte die Tests aber nicht wirklich abschliessen…

Leave a Reply