hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Hosting Security and Technology Tutorials : How-To: Installing Eaccelerator
Reply

Hosting Security and Technology Tutorials Tutorials related to server security or the like.
Forum Jump

How-To: Installing Eaccelerator

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 11-28-2005, 12:12 AM
java_dude java_dude is offline
Junior Guru Wannabe
 
Join Date: Dec 2003
Location: Middle of Nowhere, Massachusetts
Posts: 65
Lightbulb

How-To: Installing Eaccelerator


I wan't quite sure where to post this, but the technical section seemed just as good a place as any. I've seen that people have been having problems with server load and their servers being REALLY slow at times, and I was having the same problem even after tweaking my server's configuration files.

So I decided to put this guide/how-to together on how to install Eaccelerator, a PHP caching application. If you're having trouble with server load or memory, give this a try--I'm almost certain that you'll get a speed boost and your server will be much happier with you.
_____________________________

How-To: Installing Eaccelerator

What is It?

Eaccelerator is a PHP accelerator/encoder/caching utility that is based off of the old mmcache (which is no longer being maintained).

What Eaccelerator does is: it caches your PHP scripts so that the database is no longer being queried everytime someone needs a script. This is particularly useful for large forums, but pretty much anyone can benefit from it. Since these scripts are cached, you'll notice a decrease in memory use and server load.

Now, onto installing this!
______________________________

Installing Eaccelerator

1. First, you'll want to SSH into your server as the root user. you should be in the default directory now. If you're not, type in cd ~

2. Now we'll make the eaccelerator directory:

mkdir /ea/

cd /ea/


2. Now we'll grab the files, and untar them:
Notice that it's a tar.bz2 file, so we need to decompress it twice.

wget http://kent.dl.sourceforge.net/sourc....4-rc1.tar.bz2

bzip2 -d eaccelerator-0.9.4-rc1.tar.bz2

tar xvzf eaccelerator-0.9.4-rc1.tar


3. Now that we've done that, let's install Eaccelerator:
Note: in the following "export" command, you need to point that to where PHP is installed. For most, it's usually either "usr/" or "usr/local", but it may be something else.

cd /eaccelerator-0.9.4-rc1/

export PHP_PREFIX="/usr"

$PHP_PREFIX/bin/phpize

./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config

make

make install


4. It's basically installed, now we need to edit the php.ini files to include Eaccelerator. This is usually found in the /etc/ folder, but if you can't find it, run a "locate php.ini" (without quotes) to find it.
[i]I'm editting my file with nano, which pretty much anyone with a modern server should have. You can use pico or vi, it's your choice:

cd ~

nano /etc/php.ini


Now find ;Windows Extensions (press ctrl + W). Remove the mmcache lines (if you had it installed before) above this and...

----------------------------------------------------------------------------
For a PHP extension install (most will probably want this)
----------------------------------------------------------------------------

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"


----------------------------------------------------------------------------
For a Zend extension install (only if you have Zend installed, or
if you're going to install it
----------------------------------------------------------------------------

zend_extension="/usr/lib/php4/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"


5. Now we need to make the cache directory, where the cache files will be stored.

cd ~

mkdir /tmp/eaccelerator/

chmod 0777 /tmp/eaccelerator/


6. Yay, it's installed! Let's restart Apache now so that Eaccelerator will start working:

service httpd restart

7. You *should* notice some sort of speed boost or that the server load/memory use has decreased. But let's just make sure that it's installed properly.

Open up your favorite FTP client and upload the eaccelerator.php and eaccelerator_password.php files to any directory on your website. I uploaded mine to my forum directory, but you can pretty much place them anywhere in the public_html directory.

Once that's done, you can go to http://www.your-domain.com/path_to_s...ccelerator.php (of course, replacing that with the path to the script) to see if it's installed. If it's installed properly, you'll see a screen like this:



Otherwise, you'll see a screen saying that it's not installed. You have to go back through the instructions, retry it and see if that works. Check to make sure that you specified the right directories and files in the instructions above!

Now, we'll probably want to add a password to prevent some mean user from clearing the cached scripts or causing other bad stuff to happen. Navigate to the eaccelerator_password file and set an administrator name and password.

This doesn't set the password, but it gives you a line of code to place in your php.ini file (just below the eaccelerator part). Once you do this, you need to log in to view the eaccelerator page.

After you're done, you can delete or rename this file, but it's not required.
____________________________________

Q&A

Q: Is it normal for the eaccelerator cache to be cleared when Apache restarts?

A: Yes, it's completely normal. When it restarts, all cache files will be removed, but as soon as those scripts are accessed, they are added to the cache.

Q: How do I upgrade?

A: If a new version comes out, just follow these instructions but replace the new file address URL with the new one. You can check the Eaccelerator page for available mirrors, just get the address of one and grab it with wget. Then replace the old filename used in the above instructions with the newer version's name. If possible, I'll try and keep it updated.
_________________________________

So that's pretty much it. I wrote this to help those of you having trouble with high server load and memory use, and hopefully this will help.

Comments are welcome, this is my first semi-technical guide.


Last edited by java_dude; 11-28-2005 at 12:18 AM.
Reply With Quote


Sponsored Links
  #2  
Old 11-28-2005, 03:46 AM
linksys linksys is offline
Junior Guru Wannabe
 
Join Date: Sep 2005
Posts: 86
Lightbulb

Just a warning to the latest PHP 5.1.0 users: eaccelerator 0.9.3 does NOT compile under PHP 5.1.0. Wait for the new eaccelerator build.

Reply With Quote
  #3  
Old 12-07-2005, 08:42 PM
linux-tech linux-tech is offline
<?require_once("life")?>
 
Join Date: Sep 2002
Location: inside your network
Posts: 9,548
Using RC versions of software, and linking to them is a reallly bad idea, because that will cause a lot of problems!

Great tutorial, however

Reply With Quote
Sponsored Links
  #4  
Old 12-13-2005, 01:27 PM
ViAdcK ViAdcK is offline
WHT Addict
 
Join Date: Jan 2003
Location: Madrid, Spain
Posts: 174
I have installed this on a server to test it out. Thanks for the how-to.

One question though. What value do you guys recommend for the following: eaccelerator.shm_size="16" ?? I have tried with 128 for example but I don't see much of an improvement.

The server I'm using for this test has 1GB of ram and an amd64 3000 processor.

Thanks for the information

Reply With Quote
  #5  
Old 12-19-2005, 07:15 PM
tubcan tubcan is offline
Junior Guru Wannabe
 
Join Date: Dec 2003
Posts: 58
Quote:
Originally Posted by java_dude

bzip2 -d eaccelerator-0.9.4-rc1.tar.bz2

tar xvzf eaccelerator-0.9.4-rc1.tar[/i]

Just wondering, once I do the the 2nd tar, it gives me this error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors


any idea, what would cause this? Im running Centos 4.1

Reply With Quote
  #6  
Old 12-20-2005, 09:48 AM
sehe sehe is offline
Web Hosting Master
 
Join Date: Jun 2003
Posts: 962
Quote:
tar xvzf eaccelerator-0.9.4-rc1.tar
Quote:
Originally Posted by tubcan
Just wondering, once I do the the 2nd tar, it gives me this error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors


any idea, what would cause this? Im running Centos 4.1
remove the "z" parameter
Quote:
-z, --gzip, --gunzip, --ungzip
filter the archive through gzip
its not a gzipped archive so only use
Code:
tar xvf eaccelerator-0.9.4-rc1.tar
or use
Code:
tar xvjf eaccelerator-0.9.4-rc1.tar.bz2
Quote:
-j, --bzip2
filter archive through bzip2, use to decompress .bz2 files.
WARNING: some previous versions of tar used option -I to filter
through bzip2. When writing scripts, use --bzip2 instead of -j
so that both older and newer tar versions will work.

Reply With Quote
  #7  
Old 12-26-2005, 06:59 PM
damainman damainman is offline
Web Hosting Guru
 
Join Date: Nov 2003
Posts: 314
if you already have zend optimizer installed on your server, would this create any conflicts?

Reply With Quote
  #8  
Old 12-26-2005, 07:07 PM
linux-tech linux-tech is offline
<?require_once("life")?>
 
Join Date: Sep 2002
Location: inside your network
Posts: 9,548
Quote:
Originally Posted by damainman
if you already have zend optimizer installed on your server, would this create any conflicts?
I've been using it on all of mine with ZO and have no problems at all

Reply With Quote
  #9  
Old 12-31-2005, 02:38 PM
rustelekom rustelekom is offline
Telecommunication operator
 
Join Date: May 2002
Location: Russia, Moscow
Posts: 1,424
just in addition: eaccelerator do not work with php compiled as cgi, so it is not possible use it with phpsuexec or with suphp.

Reply With Quote
  #10  
Old 01-07-2006, 03:06 PM
rmoorman rmoorman is offline
New Member
 
Join Date: Jan 2006
Posts: 0
I have succesfully installed eaccelerator on debian linux ...after the installation I created the cache directory and it works fine

But I ran into trouble on next reboot ... the cachedir was removed from /tmp/
Is there some way to recreate the directory on startup?

thank you very much in advance!

Reply With Quote
  #11  
Old 01-07-2006, 04:30 PM
rmoorman rmoorman is offline
New Member
 
Join Date: Jan 2006
Posts: 0
solved it already

well ... after a little trying around I found a solution myself but maybe it helps someone
I wrote the script "eaccelerator" in /etc/init.d/

Code:
#!/bin/bash
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
and made a symlink ("ln -s /etc/init.d/eaccelerator /etc/rc2.d/S30eacc") in the specific runlevelfolder

checked that the script had executable bits set

"init 6" as root in order to reboot the system

Reply With Quote
  #12  
Old 01-07-2006, 04:34 PM
layer0 layer0 is offline
Performance Specialist
 
Join Date: Dec 2004
Location: New York, NY
Posts: 10,338
Quote:
Originally Posted by rustelekom
just in addition: eaccelerator do not work with php compiled as cgi, so it is not possible use it with phpsuexec or with suphp.
if you have PHP compiled using FastCGI it will work though.

Reply With Quote
  #13  
Old 01-09-2006, 04:59 PM
iCARus iCARus is offline
Disabled
 
Join Date: May 2003
Location: UK
Posts: 30
*

servers are very happy with eAccelerator but now our aplications doesnt work. (ModernBill & DRAMS). Is possible to get working ?

Both are Zend encoded and we use:

Code:
[Zend]
zend_optimizer.optimization_level=0
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.5.10
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.5.10
zend_optimizer.version=2.5.10a
zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20020429/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"
Thanks.

Reply With Quote
  #14  
Old 01-10-2006, 05:19 PM
UK_Guy12345 UK_Guy12345 is offline
Junior Guru Wannabe
 
Join Date: Jan 2006
Posts: 45
Eaccelerator is a good php caching engine. I would suggest people to give APC a try also. It is more regularly developed and I have found it performs on par with Eaccelerator if not better.

Reply With Quote
  #15  
Old 01-16-2006, 12:10 PM
kevinnguyen kevinnguyen is offline
Newbie
 
Join Date: Mar 2005
Posts: 11
When I entered
Quote:
export PHP_PREFIX="/usr/local"
I got this error
Quote:
export: Command not found.
When I entered
Quote:
/usr/local/bin/phpize
I got this error
Quote:
Configuring for:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20050606
Cannot find autoconf. Please check your autoconf installation and the PHP_AUTOC
ONF environment variable is set correctly and then rerun this script.
Please help
I'm using FreeBSD

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Ex-HostGator Employee Charged with Installing Backdoor to Access 2,700 Servers Web Hosting News 2013-04-19 17:38:42
Site24x7 Offers Website Monitoring Service via New WHMCS Plug-in Web Hosting News 2013-04-19 12:16:46
SoftLayer Technologies Offers Private Cloud Automation Option Web Hosting News 2013-03-07 16:39:13
Softaculous Releases Auto Installer Version 4.1.7 Web Hosting News 2012-12-19 16:45:21
Rogue Antivirus Campaign Tricks WordPress Users, Infects 30,000 Sites Web Hosting News 2012-03-08 12:10:48


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?