PDA

View Full Version : PHP 4.4.x w/ Zend Optimizer and eAccelerator


elix
08-08-2006, 09:09 PM
Okay, since there is apparently a lot of controversey here as to whether or not this works, I thought I'd post a tutorial....

* please note that all of the following paths are for a cpanel based VPS/server and you will need to adapt this a bit if you are doing this on plesk, da, etc.

First, let's make sure there are no ambigious eaccelerator related lines in php.ini.

grep -v eaccelerator -- /usr/local/lib/php.ini > /usr/local/lib/php.ini.new
mv /usr/local/lib/php.ini /usr/local/lib/php.ini.bak
mv /usr/local/lib/php.ini.new /usr/local/lib/php.ini
service httpd restart



php -v


(you shouldn't see eaccelerator)

edit /usr/local/lib/php.ini and search for extension_dir and change it to /usr/local/lib/php/extensions, so you have something like this:

extension_dir = "/usr/local/lib/php/extensions"
; extension_dir directive above.
; Be sure to appropriately set the extension_dir directive.


Now, install Zend Optimizer: (self explanatory installer basically)


wget http://downloads.zend.com/optimizer/3.0.1/ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
tar zvfx ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc21-i386
./install


Now, compile eaccelerator:


wget http://easynews.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0.9.4.tar.bz2
tar jvfx eaccelerator-0.9.4.tar.bz2
cd eaccelerator-0.9.4
/usr/local/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/bin/php-config
make
make install
mv /usr/local/lib/php/extensions/no-debug-non-zts-*/eaccelerator.so /usr/local/lib/php/extensions


edit /usr/local/lib/php.ini and add the following to the bottom:


;;eAccelerator
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/php-cache"
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="0"


create /php-cache


mkdir /php-cache; chmod 0777 /php-cache


restart apache
service httpd restart

There...finished, and if you have any problems, you have /usr/local/lib/php.ini.bak

ozgreg
08-14-2006, 03:37 AM
I can also add the php 5.14 & EACC .95 RC1 work a treat as well..

elix
08-14-2006, 10:37 AM
I can also add the php 5.14 & EACC .95 RC1 work a treat as well..
Yeah, I've used that combo (with Zend Opt.) too and it works perfect.

ecsportal
08-23-2006, 11:20 PM
Also another route is:

wget http://www.ecsportal.com/projects/eaccelerator.sh
chmod 755 eaccelerator.sh
./eaccelerator.sh



when done you see link look like

quote:/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so


copy your like to add in php.ini

edit php.ini

nano -w /usr/local/lib/php.ini



add this after Windows Extensions , in the list down.

zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="32"
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"



save and restart apache

/sbin/service httpd restart



*END*

test your work now

php -v


if your install done you will see look like this

> php -v
PHP 4.4.4 (cli) (built: Aug 23 2006 04:09:14)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.5-rc1, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with Zend Extension Manager v1.0.10, Copyright (c) 2003-2006, by Zend Technologies
with Zend Optimizer v3.0.1, Copyright (c) 1998-2006, by Zend Technologies




This installation will work on DirectAdmin + CPanel Systems

Jeremyk
08-31-2006, 08:34 PM
Hi there,

I got a question regarding a setup with Zend Optimizer and eAccelerator.

Lately i had a discussion with my hoster. Me myself doesn't know much about servers and setups but im currently using eAccelerator especially for its variable cashing.

Is it possible to setup Zend Optimized de read/run php encoded scripts with Zend and at the same time using eAccelerator?

DavidP
09-01-2006, 05:39 AM
Sure it is, but it doesn't always work as it should. As is posted on the eaccelerator site: "eAccelerator is rumored to work with Zend optimizer".

I.E. it works, but there are no guarantees, and it has issues with the PHP 4.4 releases. 4.3 works great, and 5.x should be supported in the .95 release.

elix
09-01-2006, 10:05 AM
eAccelerator doesn't officially support or not support Zend Optimizer, but I've *always* ran the two together and have never experienced a single problem with that setup. 4.4.4 also works fine.

elix
09-01-2006, 11:55 AM
and it has issues with the PHP 4.4 releases
Thought you meant 4.4.4 so I had posted accordingly initially. I'm sorry but you clearly don't know what you're doing if you can be led to believe such a thing. I can guarantee you that with my installation method it can and will work on every system with 4.4.x. Throw Zend Optimizer 3.0.1 into the mix and that's no problem either.

DavidP
09-02-2006, 05:55 AM
Maybe, but I have installed as you do and still seen problems, especially with versioning enabled.

Granted, I probably don't install eaccelerator as much as you do, but I still install it quite a bit and once in a while run into an install that just won't work.

Tony
09-02-2006, 06:09 AM
Granted, I probably don't install eaccelerator as much as you do, but I still install it quite a bit and once in a while run into an install that just won't work.

I think back when I was doing around 5-10 installs a day for a while, I saw issues with around 1 in every 10 installs. Yes, it can be installed; we're not arguing that. What we are simply stating, is that you MAY see issues installing it.

A great analogy of what we're trying to say here:

You can put a slice of bread in a toaster which "always" toasts it just right, and one day, you do the same as you always did, and it burns it. It happens, get over it, move on; but it can and will happen.

madfiddler
12-17-2006, 09:51 PM
These instructions were great for me being (and always being) a n00b.

However, in my base directory, the error log - I've got a few of these

[17-Dec-2006 05:57:24] PHP Fatal error: [Zend Optimizer] Zend Optimizer 2.5.10 is incompatible with eAccelerator 0.9.4 in Unknown on line 0


So, if I need to upgrade something, could you possibly post the exact way to go about this?

Thanks,

m

esc
12-18-2006, 03:36 AM
Maybe, but I have installed as you do and still seen problems, especially with versioning enabled.The Zend Optimizer FAQ (http://www.zend.com/products/zend_optimizer/general_faq#root_2) states that Zend Optimizer will *not* run with PHP versions compiled with any of the options 'debug', ‘thread safety’ and/or ‘versioning’.

And concerning debugger modules loaded as zend or php extension (not the above mentioned '—enable-debug' compiler flag which is used for debugging the php module itself) *none* of the common debuggers (DBG, APD, Xdebug, Activedebug) works with the Zend Optimizer. The only one which does is the Zend debugger itself.

Beside this the eAccelerator README (source package v0.9.5) recommends not to use eAccelerator together with the Zend Optimizer if one does not run encoded scripts.

Erich

elix
12-18-2006, 07:28 AM
These instructions were great for me being (and always being) a n00b.

However, in my base directory, the error log - I've got a few of these

[17-Dec-2006 05:57:24] PHP Fatal error: [Zend Optimizer] Zend Optimizer 2.5.10 is incompatible with eAccelerator 0.9.4 in Unknown on line 0


So, if I need to upgrade something, could you possibly post the exact way to go about this?

Thanks,

m

grab the latest zend and install

mkdir /usr/src/zend
cd /usr/src/zend
wget http://downloads.zend.com/optimizer/3.2.0/ZendOptimizer-3.2.0-linux-glibc21-i386.tar.gz
tar zfx Zend*
cd Zend*
./install

madfiddler
12-19-2006, 09:48 PM
:) THanks I did get it, then found out that it has to be compiled a different way for the latest version of SMF to 'see' it, not done that yet... been sorting out why phpadsnew is killing my server...