EV1Servers Forums

EV1Servers Forums (http://forum.ev1servers.net/index.php)
-   Ensim How To (http://forum.ev1servers.net/forumdisplay.php?f=56)
-   -   HOWTO: PHP eAccelerator on Ensim (http://forum.ev1servers.net/showthread.php?t=54479)

dillybar1 04-04-2005 12:36 AM

HOWTO: PHP eAccelerator on Ensim
 
HOWTO: PHP eAccelerator on Ensim
---------------------------------

eAccelerator (http://eaccelerator.net) is a branch or extension of Turck MMCache (http://turck-mmcache.sourceforge.net/index_old.html), which as far as I know is no longer developed or supported. This is a PHP accelerator, which compiles and caches php scripts in shared memory, eliminating the need to read, parse and interpret every PHP script for every request. So far i've installed this on RHEL/Ensim/PHP4, RHEL/PHP4 and RHEL/PHP5 boxes without incident. The improvement is amazing, especially if your server is already highly loaded, and you or your clients run alot of PHP scripts.

These instructions are specifically for Ensim Pro w/PHP4, although they can easily be extended to basic RHEL, and probably Plesk or Cpanel with some minor tweaking.

1) Install php-devel
Code:
# up2date php-devel


2) Download and extract the software from http://sourceforge.net/project/show...roup_id=122249:
Code:
# cd /root # wget http://cogent.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0.9.2a.tar.gz # tar -xvzf eaccelerator-0.9.2a.tar.gz # cd eaccelerator*


3) Build eaccelerator
Code:
# export PHP_PREFIX="/usr" # $PHP_PREFIX/bin/phpize # ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config # make

And if all of that went well then:
Code:
# make install


4) Generate an admin password. This is imperative if you use shared hosting, otherwise any of your clients can access eAccelerator controls if they know how!
Code:
# php eaccelerator_password.php > Changing password for eAccelerator Web Interface (eaccelerator.php) > Enter admin name: admin > New admin password: beavis > Retype new admin password: beavis > Add the following lines into your php.ini and restart HTTPD > eaccelerator.admin.name="admin" > eaccelerator.admin.password="$1$OeVNE79f$LxHuXfx22nA8nJlSJmwhQ0"

Don't restart httpd yet as it directs, just copy the bottom two lines and put them somewhere temporarily, we'll use them in step 6.

5) Create the cache directory.
Code:
# mkdir /path/to/eaccelerator-tmp-dir-name # chmod 0777 /path/to/eaccelerator-tmp-dir-name

The suggested location of the tmp dir is /tmp/eaccelerator . I don't exactly know the security implications of storing the cache for all shared hosting clients in an open directory, I imagine there is some. If one client can read the cached files of other clients, they could be decoded to potentially reveal embedded passwords in config files and such. Other than setting the cache directory on a per-site basis I don't know a workaround. It would probably be a good idea to use a directory outside of /tmp with a random name. Perhaps someone else could shed some light on this?

6) Edit php.ini
- open /etc/php.ini with your text editor of choice (vi, pico, nano, etc).
- Find the following at approximately the middle of the file:
Code:
;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;;

Add this:
Code:
zend_extension="/usr/lib/php4/eaccelerator.so" eaccelerator.shm_size="0" eaccelerator.cache_dir="/path/to/eaccelerator-tmp-dir-name" 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" eaccelerator.admin.name="admin" eaccelerator.admin.password="$1$OeVNE79f$LxHuXfx22nA8nJlSJmwhQ0"

cache_dir, admin.name, and admin.password are the values from the steps above. Don't simply copy/paste without changing those values! These are default options, which work pretty well, for info on these and more settings, see http://eaccelerator.net/IniSettingsUk or read the README file at /root/eaccelerator*/README .

7) Copy the admin script and make a phpinfo script:
Code:
# cp /root/eaccelerator*/eaccelerator.php /var/www/html/ # echo '<?php phpinfo(); ?>' > /var/www/html/phpinfo.php


8) Re-start httpd
Code:
# /etc/init.d/httpd restart


9) Make sure it's working.

Go to http://your-server-domain-or-ip/phpinfo.php and look for "Zend Technologies with eAccelerator" in the credits, and an eAccelerator section.

Go to http://your-server-domain-or-ip/eaccelerator.php and see your cache info and options.

battletank 04-06-2005 02:06 PM

Works like a charm - thanks for a super clear tutorial.

Epe 04-06-2005 04:08 PM

it doesnt work with cgi mode (high security). What a shame.

Jurgo 04-22-2005 09:38 AM

Works fine, thanks a lot for the HOWTO dillybar1.

Hence, a couple of issues.

I installed the eaccelerator on a test server (as root) and it runs like a charm. Now settings are global meaning every single chrooted site also uses the eaccelerator and all of the cached files are written to one single directory (in my case for test purposes /var/cache/eaccelerator ). If for some reason a single site would need to purge his cache this will affect every single site on the server. Same goes for the admin logon and password.

Knowing the Ensim sites are chrooted in /home/virtual/<sitename> I'd rather prefer having the cache files for each site stored in their respective virtual filesystem.

Fiddeled a bit around with both global and local php.ini file but no way to make it work that way. If someone has an idea or solution?

fragov 07-20-2005 04:31 AM

Hello, may you help me?

I'm installing eAccelerator.
After I enter line "$PHP_PREFIX/bin/phpize"

I got next:

Quote:
configure.in:9: warning: underquoted definition of PHP_WITH_PHP_CONFIG
run info '(automake)Extending aclocal'
or see http://sources.redhat.com/automake/...tending-aclocal
configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR
configure.in:33: warning: underquoted definition of PHP_EXT_DIR
configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR
configure.in:35: warning: underquoted definition of PHP_ALWAYS_SHARED
acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C
/usr/share/aclocal/glib-gettext.m4:71: warning: underquoted definition of AM_GLIB_WITH_NLS
/usr/share/aclocal/glib-gettext.m4:203: warning: underquoted definition of AM_GLIB_GNU_GETTEXT
/usr/share/aclocal/glib-2.0.m4:8: warning: underquoted definition of AM_PATH_GLIB_2_0
Configuring for:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20021010


Is it ok?

I tried to continue installation, but eAccellerator wann't work.

jsbthree 07-20-2005 07:00 AM

I get the exact same message
 
My OS is CentOS and I have cpanel with whm . Its up to date. I get that exact message and am unable to install. There are three php.ini files on is isn /etc and the others are in /usr/local and /usr/local/lib I think. What am I supposed to do with the three php.ini or which one do I use.

Epe 07-20-2005 07:26 AM

Why dont you try this precompiled rpm from DAG:
http://dag.wieers.com/packages/php-eaccelerator/

They publish frequent updates to their packages, and I use several of their packages on my centos servers (and rhel servers) but they also compiles for fedora.

spamassassin
tnef
clamav
eaccelerator
and several others are much more updated than the ones on centos.


All times are GMT -6. The time now is 06:31 AM.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.