Web Hosting Talk







View Full Version : How-To: Installing Eaccelerator


java_dude
11-28-2005, 12:12 AM
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 (http://eaccelerator.net), 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. :D
_____________________________

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/sourceforge/eaccelerator/eaccelerator-0.9.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'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:

[i]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 www.your-domain.com/path_to_script/eaccelerator.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:

http://img452.imageshack.us/img452/760/ea7ab.th.png (http://img452.imageshack.us/my.php?image=ea7ab.png)


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. :D

linksys
11-28-2005, 03:46 AM
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.

linux-tech
12-07-2005, 08:42 PM
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

ViAdcK
12-13-2005, 01:27 PM
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 :)

tubcan
12-19-2005, 07:15 PM
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

sehe
12-20-2005, 09:48 AM
tar xvzf eaccelerator-0.9.4-rc1.tar

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

-z, --gzip, --gunzip, --ungzip
filter the archive through gzip

its not a gzipped archive so only use

tar xvf eaccelerator-0.9.4-rc1.tar

or use

tar xvjf eaccelerator-0.9.4-rc1.tar.bz2


-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.

damainman
12-26-2005, 06:59 PM
if you already have zend optimizer installed on your server, would this create any conflicts?

linux-tech
12-26-2005, 07:07 PM
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

rustelekom
12-31-2005, 02:38 PM
just in addition: eaccelerator do not work with php compiled as cgi, so it is not possible use it with phpsuexec or with suphp.

rmoorman
01-07-2006, 03:06 PM
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!

rmoorman
01-07-2006, 04:30 PM
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/


#!/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

layer0
01-07-2006, 04:34 PM
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.

iCARus
01-09-2006, 04:59 PM
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:

[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.

UK_Guy12345
01-10-2006, 05:19 PM
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.

kevinnguyen
01-16-2006, 12:10 PM
When I entered
export PHP_PREFIX="/usr/local"
I got this error
export: Command not found.
When I entered
/usr/local/bin/phpize
I got this error
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

anishts
01-28-2006, 08:24 AM
You need to go to the autoconf project page and download autoconf package and install it. This will solve your problem. Autoconf produces shell scripts which automatically configure source code. I am not able to put links since this is my first post

sehe
01-28-2006, 02:11 PM
I am not able to put links since this is my first post
its http://www.gnu.org/software/autoconf/

UnrealSilence
01-29-2006, 08:17 AM
Anyone know what would cause this? Apache is running fine in the meantime.

The errors are from error log on control panel.
I can't open some pages on my forum admin panel.

[18656] EACCELERATOR: PHP unclean shutdown on opline 637 of str_replace() at /home/trustno1/public_html/forum/sources/classes/class_display.php:319
[18488] EACCELERATOR: PHP unclean shutdown on opline 77 of load_language() at /home/trustno1/public_html/forum/sources/ipsclass.php:1677
[18470] EACCELERATOR: PHP unclean shutdown on opline 747 of str_replace() at /home/trustno1/public_html/forum/sources/classes/class_display.php:330
[16917] EACCELERATOR: PHP unclean shutdown on opline 551 of str_replace() at /home/trustno1/public_html/forum/sources/classes/class_display.php:313
[16156] EACCELERATOR: PHP unclean shutdown on opline 952 of auto_run() at /home/trustno1/public_html/forum/sources/action_public/topics.php:414
[17934] EACCELERATOR: PHP unclean shutdown on opline 595 of display_topic() at /home/trustno1/public_html/forum/sources/lib/func_topic_linear.php:421
[17932] EACCELERATOR: PHP unclean shutdown on opline 1473 of str_replace() at /home/trustno1/public_html/forum/sources/action_public/topics.php:572
[16913] EACCELERATOR: PHP unclean shutdown on opline 508 of str_replace() at /home/trustno1/public_html/forum/sources/classes/class_display.php:310
[16614] EACCELERATOR: PHP unclean shutdown on opline 82 of forums_check_access() at /home/trustno1/public_html/forum/sources/classes/class_forums.php:299
[15983] EACCELERATOR: PHP unclean shutdown on opline 234 of auto_run() at /home/trustno1/public_html/forum/sources/acp_loaders/acp_components.php:142
[16754] EACCELERATOR: PHP unclean shutdown on opline 234 of auto_run() at /home/trustno1/public_html/forum/sources/acp_loaders/acp_components.php:142
[16764] EACCELERATOR: PHP unclean shutdown on opline 13 of mysql_fetch_array() at /home/trustno1/public_html/forum/ips_kernel/class_db_mysql.php:567
[16760] EACCELERATOR: PHP unclean shutdown on opline 1473 of str_replace() at /home/trustno1/public_html/forum/sources/action_public/topics.php:572

juangake
01-30-2006, 05:37 AM
Just wanted to point two details:

1) if "phpize" is not found, you need to install the php-devel package... (try yum install php-devel)

2) if "configure" throws: "error: C++ preprocessor "/lib/cpp" fails sanity check", then you need to install gcc-c++ package (try yum install gcc-c++)

Regards,

Juan

fidoadmin
03-04-2006, 11:25 PM
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. :)

where do i find this ?

Funkadelic
03-11-2006, 03:22 PM
the files are under the eaccelerator folder, just copy them over to an account:

cp eaccelerator.php /home/username/public_html/
cp eaccelerator_password.php /home/username/public_html/

leedzinh
03-22-2006, 12:31 PM
[22-Mar-2006 10:27:03] PHP Warning: Unknown(): Unable to load dynamic library './/usr/local/src/eaccelerator-0.9.4/modules/eaccelerator.so' -
.//usr/local/src/eaccelerator-0.9.4/modules/eaccelerator.so: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Mar-2006 10:27:08] PHP Warning: Unknown(): Unable to load dynamic library './/usr/local/src/eaccelerator-0.9.4/modules/eaccelerator.so' -
.//usr/local/src/eaccelerator-0.9.4/modules/eaccelerator.so: cannot open shared object file: No such file or directory in Unknown on line 0


i setup successful but in /tmp/eaccel/ i got error_log
Please help me
thanks!

funkytaco
05-15-2006, 03:52 PM
I'm posting here because I've found this thread helpful.

Tip: If your php.ini is located at:
/usr/local/Zend/etc/php.ini (because you use Zend, obviously)

You will probably need to go the "PHP extension" route, as opposed to "Zend extension" as they seem to be incompatible otherwise, at least with the versions I've tried.

Make sure you but the eaccelerator.so module in:
/usr/local/Zend/lib


php -v
PHP 4.4.2 (cli) (built: May 3 2006 01:58:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.3, Copyright (c) 2004-2004 eAccelerator, by eAccelerator
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2006, by Zend Technologies
with Zend Optimizer v2.6.2, Copyright (c) 1998-2006, by Zend Technologies


Note that once you do this, it will load as a PHP and Zend module:
[PHP Modules]
bcmath
calendar
ctype
curl
domxml
eAccelerator
ftp
gd
mcrypt
mysql
overload
pcre
posix
session
sockets
standard
tokenizer
xml
Zend Optimizer
zlib

[Zend Modules]
Zend Extension Manager
Zend Optimizer
eAccelerator

kris1351
06-02-2006, 09:59 AM
I am attempting to get this working, but my servers are all compiled with phpsuexec enabled. With the install done I see this on the php -v, but no files are being written to the tmp file. In therory it looks as if it is working, but with the no writes does that mean my efforts are futile?

PHP 4.4.2 (cli) (built: Apr 15 2006 00:14:01)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.4, Copyright (c) 2004-2005 eAccelerator, by eAccelerator
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2006, by Zend Technologies
with Zend Optimizer v2.6.2, Copyright (c) 1998-2006, by Zend Technologies

Maze Hosting
06-04-2006, 01:56 AM
if you already have zend optimizer installed on your server, would this create any conflicts?
I think yes, I got conflicts after installing Eaccelerator with Zend Optimizer.

mesobob
10-08-2006, 09:51 PM
Ok, after much fussing around I finally managed to get this installed on my VPS. I`ve installed it straight out of the box, and using the following...


zend_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"


Just a few clicks with one of my forums to test the module I noticed the tmp/eaccelorator folder was two pages full. This is where I`m stumped, do I clear this folder manually, does the module do it at various intervals or do I set up some kind of cron?

Thanks.

DamirG
10-13-2006, 06:33 PM
well i install newest stable version and follow instruction but i can find 2 those file to check is everything installed corectly


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



eaccelerator.php and eaccelerator_password.php

RaghavT
11-15-2006, 06:23 PM
In new version, theres nothing like that

supershaney
11-17-2006, 07:48 AM
There's a file in that package called control.php - upload that to your server and add the following to your php.ini to point to control.php:

eaccelerator.allowed_admin_path = "/path/to/control.php"

The default username and password is admin:eAccelerator

You can edit the first few lines in control.php to set your own username and password.

By accessing control.php from your browser you can then manually clear the cache.

Also, take a look at the options "eaccelerator.shm_ttl" and "eaccelerator.shm_prune_period" on the following link for details on how to get eAccelerator to remove old scripts that haven't been accessed in a certain time when the cache is full: eaccelerator.net/wiki/Settings

Nneel
11-30-2006, 04:34 AM
im facing the error

regrding control.pp

Cached scripts

Warning: This script isn't in the allowed_admin_path setting! in /home/golponet/public_html/control.php on line 300

Warning: uasort() [function.uasort]: The argument should be an array in /home/golponet/public_html/control.php on line 135

Warning: Invalid argument supplied for foreach() in /home/golponet/public_html/control.php on line 139

and
Removed scripts

Warning: This script isn't in the allowed_admin_path setting! in /home/golponet/public_html/control.php on line 303

Warning: uasort() [function.uasort]: The argument should be an array in /home/golponet/public_html/control.php on line 135

Warning: Invalid argument supplied for foreach() in /home/golponet/public_html/control.php on line 139Filename ↓
MTime Size Reloads Hits


info:
document root: /home/golponet/public_html
SERVER["DOCUMENT_ROOT"] /home/golponet/public_html
_SERVER["PATH"] /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin

any one can help me?

mtrc
12-25-2006, 07:53 AM
Well, I have a strange error regarding 0.9.5. There is a file called bugreport.php. Report generated by this file is ok except
the last line:

/path/to/eacache doesn't exist!

This dir is ok and have files cached under it.

Any idea?

mtrc
12-26-2006, 03:56 AM
Lol, I found the problem.

HD Fanatic
02-08-2007, 01:10 AM
There's a file in that package called control.php - upload that to your server and add the following to your php.ini to point to control.php:



The default username and password is admin:eAccelerator

You can edit the first few lines in control.php to set your own username and password.

By accessing control.php from your browser you can then manually clear the cache.

Also, take a look at the options "eaccelerator.shm_ttl" and "eaccelerator.shm_prune_period" on the following link for details on how to get eAccelerator to remove old scripts that haven't been accessed in a certain time when the cache is full: eaccelerator.net/wiki/Settings
Thanks, no wonder why eaccelerator.php shows that eaccelerator is NOT installed!! 0.9.5 doesn't use that file anymore.

Question, why does it only cache up to 173 scripts, doesn't increase after 2 days o_0

HD Fanatic
02-08-2007, 01:44 AM
Does eaccelerator automatically purge old cached scripts in /tmp/eaccelerator/ ?

roro
04-30-2007, 11:33 AM
Im getting exactly the same warnings on control.php im
Cached scripts:
Warning: This script isn't in the allowed_admin_path setting! in /home/musik/public_html/panel/control.php on line 300

Warning: uasort(): The argument should be an array in /home/musik/public_html/panel/control.php on line 135

Warning: Invalid argument supplied for foreach() in /home/musik/public_html/panel/control.php on line 139

Removed scripts:
Warning: This script isn't in the allowed_admin_path setting! in /home/my-musik/public_html/panel/control.php on line 303

Warning: uasort(): The argument should be an array in /home/my-musik/public_html/panel/control.php on line 135

Warning: Invalid argument supplied for foreach() in /home/my-musik/public_html/panel/control.php on line 139

using 0.9.5
php 4.
apache 2