PROBLEM
I want to install eAccelerator for PHP
ENVIRONMENT
- On-Premise Server + WebMail Installations: Version 6.0 > Current Version
- Webmail Only Installations: Version 6.0 > Current Version
CAUSE
eAccelerator for PHP is not installed
RESOLUTION
This guide covers the steps you need to take to install EAccelerator (http://eaccelerator.net). eAccelerator is a free open-source PHP accelerator and optimizer. It optimizes scripts to speed up their execution, typically reducing server load and increasing the speed of your PHP code by up to ten times.
First, download the latest version of EAccelerator from: http://bart.eaccelerator.net/source/
Untar, then go to the unpacked directory:
% tar xvfj eaccelerator-0.9.6. tar .bz2 % cd eaccelerator-0.9.6 |
Find the base directory of your PHP installation. Typically, this resides two directories down from where your PHP binary is. For this guide, we will assume that php is installed in "/usr/local/bin/php" - therefore, making the base directory "/usr/local".
Execute the following commands inside the eAccelerator directory:
% export PHP_PREFIX= "/usr/local/" % $PHP_PREFIX /bin/phpize |
Then, run the configure script:
% . /configure -- enable -eaccelerator=shared --with-php-config=$PHP_PREFIX /bin/php-config % make % make install |
The last command will output a path. Take note of this. For our example, the path will look like:
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ |
Find your php.ini file. It is commonly under /etc/php.ini or /usr/local/lib/php.ini. Add these lines to your php.ini file:
[eaccelerator] zend_extension= "/usr/local/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" eaccelerator.shm_size= "16" 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= "0" eaccelerator.shm_prune_period= "0" eaccelerator.shm_only= "0" eaccelerator.compress= "1" eaccelerator.compress_level= "9" |
Make sure that the line in bold (zend_extension) is defined as the same path you took note of earlier in the installation. Restart Apache afterwards:
% apachectl restart |
To test if eAccelerator is active, execute the following command:
% php - v |
This should output something similar to:
PHP 5.3.1 (cli) (built: Jan 14 2010 22:06:44) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies with eAccelerator v0.9.6, Copyright (c) 2004-2010 eAccelerator, by eAccelerator |
Congratulations! You now have eAccelerator active.
Comments