All for Joomla All for Webmasters

eAccelerator Configuration With PHP5


Step By Step eAccelerator Configuration

eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. 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. Step by Step eaccelerator install procedure as below.

I have tested this on a CentOS 5.5 server with the IP address 192.168.100.101 where Apache2 and PHP5 are already installed and working. If you do not have install required packages.

# yum install httpd* php* -y

# service httpd restart

# chkconfig httpd on

To test PHP, create the file phpinfo.php in document root /var/www/html.

# vim /var/www/html/phpinfo.php

<?php

phpinfo();

?>

Save and exit the file.

Call that file in a browser: http://192.168.100.1/phpinfo.php

As you see, we have PHP 5.1.6 installed…

eAccelerator0

But eAccelerator isn’t mentioned anywhere on the page:

eAccelerator1

Unfortunately, there’s no eAccelerator package for CentOS 5.0 in the official repositories, therefore we must compile and install it from the sources. Before we can do this, we need to install some prerequisites:

# yum groupinstall ‘Development Tools’

Download latest version of eAccelerator from the eAccelerator web site.

Don’t Miss to Read

LAMP Linux | Installation of LAMP on Linux Server

# wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2

# tar xvfj eaccelerator-0.9.6.1.tar.bz2

# cd eaccelerator- 0.9.6.1

# phpize

Configuring for:

PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025

# ./configure

# make

Are you getting any errors like this:

eaccelerator-0.9.6.1/ea_store.c: In function ‘store_property_access_check’:

eaccelerator-0.9.6.1/ea_store.c:683: error: ‘zend_property_info’ has no member named ‘ce’

make: *** [ea_store.lo] Error 1

If yes, follow below steps to solve it.

# vim ea_store.c

go to line number 683

look for return (child_info->ce != from); and put // (Double slash) to comment it. Save and exit the file now run make again.

# make

# make install

eAccelerator is now installed. Now we have to tell PHP installation that it should make use of eAccelerator.

On CentOS 5.0, the configuration files for the various PHP 5 modules are stored in the /etc/php.d directory, and this directory is referenced in the main PHP5 configuration file /etc/php.ini, meaning all files in /etc/php.d are read in whenever Apache is started/restarted. So all we do is create the file /etc/php.d/eaccelerator.ini:

# vim /etc/php.d/eaccelerator.ini

extension=”eaccelerator.so”

eaccelerator.shm_size=”16″

eaccelerator.cache_dir=”/var/cache/php/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″

As you see, we are using the disk cache directory /var/cache/php/eaccelerator which we must create now and make it world-writable:

# mkdir -p /var/cache/php/eaccelerator

# chmod 0777 /var/cache/php/eaccelerator

Restart Apache so that our new PHP configuration takes effect:

# /etc/init.d/httpd restart

Again open phpinfo.php again in a browser: http://192.168.100.101/phpinfo.php

You should now see eAccelerator mentioned on the page which means it has successfully been integrated and is working as expected.

eAccelerator2

eAccelerator Configuration With PHP5

log in

Become a part of our community!

reset password

Back to
log in
Choose A Format
Personality quiz
Trivia quiz
Poll
Story
List
Meme
Video
Audio
Image