Call us Toll-Free:
1-800-218-1525
Email us

 Sponsors

How to install eAccelerator

Dawn Rossi, 03-29-2007
Here is a tutorial for installing eAccelerator. I ran into a few problems, but they were mostly because of the shared server environment that I'm working in and not eAccelerator code problems. Without going into too much detail, the only problems I ran into while installing this was version mis-match issues (phpize wasn't configuring for the version of php I was currently using) and were easily resolved.

So, here we go. Very simple installation:

First, I created a directory to work in while installing eAccelerator and downloaded the source package we need to get started. Here is the file I used:

http://bart.eaccelerator.net/source/...-0.9.5.tar.bz2

First thing to do is unpack the source:

[root@softwareprojects /home/chris/ea]# tar -jxf eaccelerator-0.9.5.tar.bz2

Now we need to run phpize to configure the module for our current version of PHP:

[root@softwareprojects /home/chris/ea/eaccelerator-0.9.5]# phpize
Configuring for:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20050606

Next, we need to run configure and ask it to compile a shared module for apache:

[root@softwareprojects /home/chris/ea/eaccelerator-0.9.5]# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/bin/php-config

Everything went well here. If you are following these steps, make sure your php-config file is in the same directory as mine. If not, change it in your CLI call to configure (duh).

Next, I compiled the shared module by running "make". This went off without a hitch and dropped my newly compiled shared module in the modules/ directory.

Instead of running "make install" I chose to simply copy the module to my current extensions directory (make install creates some weird directory, so we'd have to move it anyway):

[root@softwareprojects /home/chris/ea/eaccelerator-0.9.5]# cp modules/eaccelerator.so /usr/local/lib/php/extensions/current/

Now that we have the module installed, we need to tell php.ini to load it. You can install this as either a Zend extension or a PHP extension.

Add these lines to your php.ini to install it as a Zend extension:

zend_extension="/usr/local/lib/php/extensions/current/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"

If you use a thread safe build of PHP you must use "zend_extension_ts" instead of "zend_extension".

Use these lines instead if you are running it as a PHP extension (this is the one I chose):

extension="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"

Great. PHP is all ready to load this thing. Now the only thing we need to do is create the cache directory and set the proper permissions on it:

[root@softwareprojects /home/chris/ea/eaccelerator-0.9.5]# mkdir /tmp/eaccelerator
[root@softwareprojects /home/chris/ea/eaccelerator-0.9.5]# chmod 777 /tmp/eaccelerator

Now, just restart apache and you should be good to go. I was confused at first thinking you needed to call a set of functions in order to get eAccelerator to start caching files. I was wrong however. eAccelerator does its own thing behind the scenes.

The only thing you have to do to verify its installation and functionality is create a phpinfo(); file and look for the eAccelerator section. As long it shows that you have some scripts in cache then you are good to go. You can also enable logging in eAccelerator (if you still aren't convinced) by adding this to your php.ini:

eaccelerator.log_file="/var/log/eaccelerator.log"

Hopefully we'll see a speed increase using eAccelerator. I'd love to see some reply posts here to see if its speeding up other sites, or if this tutorial helped anyone out.

Enjoy!
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions