rebuilding php with a custom eaccelerator

aww

Well-Known Member
#1
I think php 4.4.8 will be the first time I try the internal php rebuilder now in LiteSpeed.

However I am concerned that the default eaccelerator build doesn't have features that I want (mainly session support in shared memory for extra speed).

I take it that if I use the internal rebuild I won't be able to use a custom eaccelerator?

Any chance you'd consider adding these options to your eaccelerator builds?

Code:
--with-eaccelerator-shared-memory 
--with-eaccelerator-sessions 
--with-eaccelerator-content-caching
They were turned off by default sometime before eaccelerator 0.9.5 so they can only be turned back on at build time. But they only get used if the setting is placed into php.ini, and then only if other code is changed too, so it should not upset any existing configurations.

Also, what is going to happen to my php.ini - will rebuilding php and including eaccelerator from the menu edit my php.ini? I have many custom settings in there I want to retain.

Thanks for any insight.
 

mistwang

LiteSpeed Staff
#2
Yes, we can include those options if it does not hurt anything.
the php build script does not update your php.ini, you still need to update it manually.
 

aww

Well-Known Member
#3
I just wanted to update that I've figured out how to maintain the same php and eaccelerator version between my cpanel+apache and litespeed installs (4.8 + 0.9.5.2)

If anyone ever needs the script I use to make a custom eaccelerator compile just let me know. I have it build eaccelerator for both apache and litespeed and copy it into both places as well as add some good php.ini settings. I also turn on the above three options. Then you can use eaccelerator for session support too which adds slightly more performance, especially on a VPS where disk access can be slower.

It's based on this script from medialayer with several tweaks:
http://www.webhostingtalk.com/showthread.php?t=549666
http://tutorials.medialayer.com/cPanel/eaccelerator.sh
 
Last edited:
#4
I just wanted to update that I've figured out how to maintain the same php and eaccelerator version between my cpanel+apache and litespeed installs (4.8 + 0.9.5.2)

If anyone ever needs the script I use to make a custom eaccelerator compile just let me know. I have it build eaccelerator for both apache and litespeed and copy it into both places as well as add some good php.ini settings. I also turn on the above three options. Then you can use eaccelerator for session support too which adds slightly more performance, especially on a VPS where disk access can be slower.

It's based on this script from medialayer with several tweaks:
http://www.webhostingtalk.com/showthread.php?t=549666
http://tutorials.medialayer.com/cPanel/eaccelerator.sh
Out of curiosity - are you using phpsuexec with LiteSpeed?
 

aww

Well-Known Member
#5
Out of curiosity - are you using phpsuexec with LiteSpeed?
That's where PHP runs as the user account it's currently executing code for?
No, it causes too many issues with too many programs unfortunately.

I was also going to try some of the hardening programs but apparently they have similar problems.
 
#6
That's where PHP runs as the user account it's currently executing code for?
No, it causes too many issues with too many programs unfortunately.

I was also going to try some of the hardening programs but apparently they have similar problems.
What issues have you found? Have you ever used phpsuexec with LiteSpeed?
 

aww

Well-Known Member
#7
What issues have you found? Have you ever used phpsuexec with LiteSpeed?
Well phpsuexec has several issues that I am aware of:
1. it's a dead project with no further code development for awhile now
2. no opcode cache will work with it (ie. xcache, apc, eaccelerator)
3. it causes a 10% load/resource increase
4. it breaks PHP_AUTH
5. it breaks some mod_rewrite rules (on Apache, I have no idea how litespeed would react)
6. any directory/file accidentally set above 755 by any software installer will fail to be usable (though this is apparently a feature)
7. it gives a false sense of security since it can be bypassed rather easily through shell - unless you are going to also disable_functions = dl,exec,passthru, proc_open, proc_close, shell_exec, system - in which case you might as well just use safe mode!


If you feel safe with phpsuexec, try googling for webadmin.php (which is a legit php file browsing script for servers) and watch how you can see your entire server even with open_basedir and phpsuexec
 
#8
1. it's a dead project with no further code development for awhile now
Doesn't apply to LiteSpeed's option for suexec.

2. no opcode cache will work with it (ie. xcache, apc, eaccelerator)
All three work with LiteSpeed's suexec.

3. it causes a 10% load/resource increase
Haven't personally seen that, although it's possible.

4. it breaks PHP_AUTH
Nope.

5. it breaks some mod_rewrite rules (on Apache, I have no idea how litespeed would react)
Nope.

6. any directory/file accidentally set above 755 by any software installer will fail to be usable (though this is apparently a feature)
Nope, not with LiteSpeed.

7. it gives a false sense of security since it can be bypassed rather easily through shell - unless you are going to also disable_functions = dl,exec,passthru, proc_open, proc_close, shell_exec, system - in which case you might as well just use safe mode!
This isn't pertinent to the discussion.

I understand now, it appears you haven't really studied the phpsuexec option for LiteSpeed, and are causing it with other options phpsuexec (namely with Apache) in general.
 

aww

Well-Known Member
#9
I understand now, it appears you haven't really studied the phpsuexec option for LiteSpeed, and are causing it with other options phpsuexec (namely with Apache) in general.
If you are saying litespeed's suexec will give me all the benefits of phpsuexec without any of the drawbacks I will most certainly give it a try. It would be foolish not to.

Can you give me a hint as far as what I need to do to enable it?
Is this what you are referring to?
http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:cgi_fcgi_lsapi_php_suexec

update 1: Wait, it's not as simple as turning on the suexec option in litespeed's control panel is it? Because I just did that and things are still running after a restart.

update 2: nope, eaccelerator is not caching scripts among different users - they are isolated and cannot share the memory...
 
Last edited:

ffeingol

Well-Known Member
#10
it is as simple as turning on suexec in the control panel but that is the simple part. Your then going to have (possibly) tons of ownership/permission issues. Before you were running suexec any files uploaded by php (for example) will be owned by nobody. Now that your running suexec it will run as the real user-id and you won't be able to write to those files anymore.

You'll run into this issue with things like:

galleries (all the uploaded pictures)
forums (uploaded avatars)
joomla/mambo (any module/component/theme installed via the software)

Frank
 

anewday

Well-Known Member
#11
it is as simple as turning on suexec in the control panel but that is the simple part. Your then going to have (possibly) tons of ownership/permission issues. Before you were running suexec any files uploaded by php (for example) will be owned by nobody. Now that your running suexec it will run as the real user-id and you won't be able to write to those files anymore.

You'll run into this issue with things like:

galleries (all the uploaded pictures)
forums (uploaded avatars)
joomla/mambo (any module/component/theme installed via the software)

Frank
Do you meant to say phpsuexec in the 1st and 4th lines? :confused:
 
#13
update 2: nope, eaccelerator is not caching scripts among different users - they are isolated and cannot share the memory...
eAccelerator does cache scripts, however it must use the disk (unless you mount it as a RAM disk). It will still help quite a bit from a performance standpoint.
 

anewday

Well-Known Member
#14
Sorry for my ignorance, I didn't mean to nitpick just that I'm still learning and thought there was a difference between the two in this discussion.
 

aww

Well-Known Member
#15
eAccelerator does cache scripts, however it must use the disk (unless you mount it as a RAM disk). It will still help quite a bit from a performance standpoint.
eAccelerator does indeed use a ram pool (which I am calling an opcode cache). I've got 64mb allocated and it uses it properly when suexec is not enabled. It speeds things nicely. When it runs out of the 64mb, it uses the disk to store more opcode but I rarely get there on my box. I also use the cache for php's session storage which is another nice performance boost on my VPS where disk IO is the worst regulated part.

When suexec is enabled in litespeed, the eacclerator opcode cache does not appear to be working properly.
 
Top