Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: Installing eAccelerator In Ubuntu Server.

Installing eAccelerator In Ubuntu Server: Difference between revisions

From MoodleDocs
(New page: {{Review}} = Installation Guide for eAccelerator on Ubuntu Server = "eAccelerator is a free open-source PHP accelerator & optimizer. It increases the performance of PHP scripts by cachin...)
 
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Review}}
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.


= Installation Guide for eAccelerator on Ubuntu Server =
:"eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times." - [http://eaccelerator.net/ eaccelerator.net eAccelerator Homepage]
 
"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." - [http://eaccelerator.net/ eaccelerator.net eAccelerator Homepage]




== Step-By-Step Command Line Installation ==
== Step-By-Step Command Line Installation ==


===Change directory to home/user directory===


* '''Change directory to home/user directory'''
Make sure you are in your own user directory, to do this use something like the following:


''Make sure you are in your own user directory, to do this use something like the the following...''
cd /usr/home/username


cd /ur/home/username
=== Download and extract file===


 
Download and extract version 0.9.5.3 - later versions dropped support for the PHP commands used by Moodle and other PHP software (the W3 Total Cache Wordpress plugin for example)....
* '''Download and extract version 0.9.5.3 (this is the version that supports php commands required by Moodle and w3 Total Cache)....'''


  wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
  wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
Line 23: Line 21:




* '''Build and install....'''
===Build and install===
 
To use the following ''phpize'' and ''php-config'' commands you will need to have the PHP development package installed, in Ubuntu you can install the PHP5 development package using:
 
sudo apt-get install php5-dev
 
After checking that this is installed you can continue:


  sudo phpize
  sudo phpize


''(The following step will work on servers that have a single PHP install. For those with mroe than one version of PHP see notes on http://eaccelerator.net/wiki/InstallFromSource regarding having php in path, export path if required - This could affect the "--with-php-config" line below)''
*The following step will only work on servers that have a single PHP install. For those with more than one version of PHP see notes on http://eaccelerator.net/wiki/InstallFromSource.


  sudo ./configure --with-php-config=/usr/bin/php-config --with-eaccelerator-shared-memory --enable-eaccelerator=shared
  sudo ./configure --with-php-config=/usr/bin/php-config --with-eaccelerator-shared-memory --enable-eaccelerator=shared
Line 36: Line 40:




* '''Check install location....'''
===Check install location===
Check the install area by changing directories:


  cd /
  cd /
  cd usr/lib/php5/
  cd usr/lib/php5/


''... in here you should see a folder named like a date string - eg... "20060613".  Remember the folder name, you may need to use this to point to the eaccelerator.so file in the configuration options below.''
In this directory you should see a folder named like a date string - eg... "20060613".  Remember the folder name, you may need to use this to point to the eaccelerator.so file in the configuration options below.


===Add configuration options for eAccelerator to php.ini===


* '''Add configuration options for eAccelerator to php.ini...'''
Change to the PHP config directory and open the php.ini file for editing:


  cd /
  cd /
Line 50: Line 56:
  sudo nano php.ini
  sudo nano php.ini


 
Add the following to end of php.ini file changing folder names appropriately, do not worry if the ''cache_dir'' directory does not exist on your system we will create it next:
* '''Add the following to end of php.ini file (changing folder name appropriately)...'''


  ; eAccelerator configuration
  ; eAccelerator configuration
Line 75: Line 80:




* '''Create cache directory....'''
===Create cache directory===


Next we will create the cache directory used in the previous step:


''One last very important step is creating the cache directory that you configured in the previous step. The default value is /tmp/eaccelerator It's easy because it's writable to everyone, but it isn't very smart because on a lot of systems this directory is cleaned on reboot. A better place would be /var/cache/eaccelerator. Create the directory and make sure it's writable for the user eAccelerator runs under (usually the user which you webserver runs as).''
sudo mkdir /var/cache/eaccelerator


''A safe bet is making it world writable. A safer and cleaner way would be to change the owner of the directory to the same user PHP runs as (most of the time the same user as Apache or Lighttpd) and set 0644 permissions.''
This directory must be writeable by the user eAccelerator runs under (usually ''www-data''):


  mkdir /tmp/eaccelerator
  sudo chmod 0777 /var/cache/eaccelerator
chmod 0777 /tmp/eaccelerator


For additional security we could change the owner of the directory to the same user eAccelerator runs under and set 0644 permissions:


* '''Restart Apache..'''.
sudo chown www-data:www-data /var/cache/eaccelerator
sudo chmod 0644 /var/cache/eaccelerator
 
 
 
===Restart Apache===
Restart Apache:


  sudo /etc/init.d/apache2 restart
  sudo /etc/init.d/apache2 restart


==See also==
See the following web page for more info....


* Also, see the following web page for more info....
[http://eaccelerator.net/wiki/InstallFromSource http://eaccelerator.net/wiki/InstallFromSource]


[http://eaccelerator.net/wiki/InstallFromSource http://eaccelerator.net/wiki/InstallFromSource]
[[Category:Installation]]
[[Category:Tutorial]]
[[Category:Performance]]
[[Category:Administrator]]

Latest revision as of 18:56, 14 January 2011

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.net eAccelerator Homepage


Step-By-Step Command Line Installation

Change directory to home/user directory

Make sure you are in your own user directory, to do this use something like the following:

cd /usr/home/username

Download and extract file

Download and extract version 0.9.5.3 - later versions dropped support for the PHP commands used by Moodle and other PHP software (the W3 Total Cache Wordpress plugin for example)....

wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/


Build and install

To use the following phpize and php-config commands you will need to have the PHP development package installed, in Ubuntu you can install the PHP5 development package using:

sudo apt-get install php5-dev 

After checking that this is installed you can continue:

sudo phpize
sudo ./configure --with-php-config=/usr/bin/php-config --with-eaccelerator-shared-memory --enable-eaccelerator=shared
sudo make clean
sudo make
sudo make test
sudo make install


Check install location

Check the install area by changing directories:

cd /
cd usr/lib/php5/

In this directory you should see a folder named like a date string - eg... "20060613". Remember the folder name, you may need to use this to point to the eaccelerator.so file in the configuration options below.

Add configuration options for eAccelerator to php.ini

Change to the PHP config directory and open the php.ini file for editing:

cd /
cd etc/php5/apache2
sudo nano php.ini

Add the following to end of php.ini file changing folder names appropriately, do not worry if the cache_dir directory does not exist on your system we will create it next:

; eAccelerator configuration
; Note that eAccelerator may also be installed as a PHP extension or as a zend_extension
; If you are using a thread safe build of PHP you must use
; zend_extension_ts instead of zend_extension
;extension                       = "/usr/lib/php5/20060613+lfs/eaccelerator.so"
zend_extension                  = "/usr/lib/php5/20060613/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"
eaccelerator.allowed_admin_path = "/var/www/eaccelerator"


Create cache directory

Next we will create the cache directory used in the previous step:

sudo mkdir /var/cache/eaccelerator

This directory must be writeable by the user eAccelerator runs under (usually www-data):

sudo chmod 0777 /var/cache/eaccelerator

For additional security we could change the owner of the directory to the same user eAccelerator runs under and set 0644 permissions:

sudo chown www-data:www-data /var/cache/eaccelerator
sudo chmod 0644 /var/cache/eaccelerator


Restart Apache

Restart Apache:

sudo /etc/init.d/apache2 restart

See also

See the following web page for more info....

http://eaccelerator.net/wiki/InstallFromSource