eaccelerator install in linux (Ubuntu)


What does it do?
It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated.

How to install eaccelerator?

  • Download the eaccelerator-0.9.5.3 at http://www.eaccelerator.net/
  • unzip the file under temporary directory, unzipped/ , for example.
  • You need php5-dev pack first in order to use "phpize"

    apt-get install php5-dev

  • Once it is done, phpize will be installed in /usr/bin/phpize .
  • execute the below commands at the command prompt unzipped/ .
      # export PHP_PREFIX="/usr"
      # $PHP_PREFIX/bin/phpize
      # ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
      # make
    

  • This will generate "eaccelerator.so" under ./unzipped/modules directory.
  • run

    make install

  • This will copy eaccelerator.so under the /usr/lib/php5 directory. Im my case, it was installed under 20060613+lfs.

    /usr/lib/php5/20060613+lfs/eaccelerator.so

  • Then, copy unzipped/eaccelerator.ini file to /etc/php5/conf.d directory.

    cp unzipped/eaccerlerator.ini /etc/php5/conf.d/eaccelorator.ini

  • Caution : /etc/php5/conf.d directory was available since php was configured with --with-config-file-scan-dir=/etc/php5/conf.d option. If you don't have the directory /etc/php5/conf.d, then copy the below (the content of eaccelerator.ini) in your php.ini file.
      zend_extension="/usr/lib/php5/20060613+lfs/eaccelerator.so" // You need to change this according to your seeting
      eaccelerator.shm_size="64"
      eaccelerator.cache_dir="/tmp/eaccelerator"
      eaccelerator.enable="1"
      eaccelerator.optimizer="1"
      eaccelerator.check_mtime="1"
      eaccelerator.debug="0"
      eaccelerator.filter=""
      eaccelerator.shm_max="0"
      eaccelerator.shm_ttl="3600"
      eaccelerator.shm_prune_period="0"
      eaccelerator.shm_only="0"
      eaccelerator.compress="1"
      eaccelerator.compress_level="9
      eaccelerator.admin.name="yourusername"
      eaccelerator.admin.password="yourpassword"
    

  • in php.ini file, put the below line around the extension config lines.

    extension=eaccelerator.so

  • Create cache directory under /tmp directory.
     
     mkdir /tmp/eaccelerator
     chown www(or whatever) /tmp/eaccelerator
     chmod 0700 /tmp/eaccelerator
    

  • restart apache

    /etc/init.d/apache2 restart

  • Make it sure that the module (.so) was properly installed by looking at phpinfo(); with an web page. The below or similar message will appear in phpinfo(); page.
      This program makes use of the Zend Scripting Language Engine:
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
        with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
    

  • phpinfo()?
    make a file phpinfo.php under htdocs (or html) directory (something like /var/www), then put the below lines;
      <?php
        phpinfo
    ();
      
    ?>

  • Then, view this page with a web browser with http://localhost/phpinfo.php URL.

    see more info at http://coffeenix.net/board_print.php?bd_code=1139


    CategoryPhp
    Retrieved from http://wiki.commres.org/wiki.php/eaccelerator
    last modified 2012-05-08 14:46:13