Integrating eAccelerator Into PHP5 (Fedora 7)

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2007-09-20 11:02. :: Fedora | PHP

Integrating eAccelerator Into PHP5 (Fedora 7)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 09/17/2007

This guide explains how to integrate eAccelerator into PHP5 on a Fedora 7 system. From the eAccelerator project page: "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."

This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I have tested this on a Fedora 7 server with the IP address 192.168.0.100 where Apache2 and PHP5 are already installed and working. I'll use Apache's default document root /var/www/html in this tutorial for demonstration purposes. Of course, you can use any other vhost as well, but you might have to adjust the path to the info.php file that I'm using in this tutorial.

 

2 Checking PHP5's Current State

First, before we install eAccelerator, let's find out about our PHP5 installation. To do this, we create the file info.php in our document root /var/www/html:

vi /var/www/html/info.php

<?php
phpinfo();
?>

Afterwards, we call that file in a browser: http://192.168.0.100/info.php

As you see, we have PHP 5.2.2 installed...

... but eAccelerator isn't mentioned anywhere on the page:

 

3 Installing eAccelerator

Fortunately, there's an eAccelerator package for Fedora 7, php-eaccelerator, which we can install like this:

yum install php-eaccelerator

The eAccelerator configuration is stored in the file /etc/php.d/eaccelerator.ini. You can read up on the various configuration settings on this page: http://www.eaccelerator.net/wiki/Settings.

Afterwards, we restart Apache so that our new PHP configuration takes effect:

/etc/init.d/httpd restart

Afterwards, open info.php again in a browser: http://192.168.0.100/info.php

You should now see eAccelerator mentioned on the page which means it has successfully been integrated and is working as expected (I've marked the eAccelerator line in the below screenshot for better visibility):

 

4 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Kinsfire (registered user) on Wed, 2007-09-26 16:16.

Not sure why or how, but the install was preventing Apache from running. Everything would say that it was stopping and starting correctly, but whenever I installed php-eaccelerator, httpd would fail to start. When I removed it, it started right back up.

Weird.