PDA

View Full Version : What "PHP" option to use? Fast-CGI, CGI, Mod-PHP or SuPHP.


edge
2nd April 2009, 10:07
I'm just about ready to install WordPress on my ISPconfig 3 production server for a client, and now I need to know what PHP option is the best to use.
I've tested WordPress on a test server with Fast-CGI, and it looked like all was working fine.

As it's for a client (who has no clue on what he is doing), I was wondering if Fast-CGI is the best option to select?
I've got the following options: Fast-CGI, CGI, Mod-PHP or SuPHP

till
2nd April 2009, 10:42
The php option depends on traffic that you expect for the site and if the site e.g. uploads or creates images or files on the server.

mod_php:

- fast
- runs not under admin user of the site
- well suited for low and high traffic sites, but not for cms systems like joomla.

suphp:

- not so fast
- script runs under web admin
- secure
- well suited for low traffic sites

fastcgi

- fast
- script runs under web admin
- secure
- well suited for high traffic sites

so basicalley the decision is, if a site is low traffic, use suphp. suphp spawns a new cgi process for every page request, but it does not use resources when no pages are requested. On the opposite fastcgi, the php processes are running permanently even if no page is requested, this is faster and fine for a high traffic site but for a small homepage with 100 pageviews per hour you would waste resources.

edge
2nd April 2009, 11:10
Interesting information!

Thank you

edge
2nd April 2009, 11:16
Looks like WordPress does work fine with "mod_php", and as it's not running under admin I will stick with this sertting!

Once again thank you for the info.

Ovidiu
30th April 2009, 11:07
ok, very good info so far, but i.e. wordpress, has a built in update module which means the user or the group that the web server runs as needs write access to vertain paths.

which one would I chose now? shall I chose a version where apache runs as the webadmin? I guess that is right? if it is a low traffic site, I shall chose suPhp but do I also have to check the box for suexec or isn't that needed?

till
30th April 2009, 14:39
ok, very good info so far, but i.e. wordpress, has a built in update module which means the user or the group that the web server runs as needs write access to vertain paths.

The wordpress update module can also connect to the site with ftp, so all of them will work.

But you should use either suphp or fastcgi with suexec.

Ovidiu
30th April 2009, 16:21
well, if its a site for a client, its easier if he doesn't have to enter any ftp credentials, it jsut confuses people.

besides, if I edit a website, in the optiosn tab I see: Linux User web1
Linux Group client1 - so apache would run when using suPhp as web1 right? but what if the user uploads stuff with his ftp userlogin? which seems to differ from the linux user? I mean the files will be owned by the ftp user then :-(

Ovidiu
3rd May 2009, 15:11
ok, now I was looking for a php accelerator and usually I use eaccelerator.
BUT I foudn this statement on their website:

eAccelerator only works with mod_php or php in fastcgi mode. It can't be used in cgi or cli because eAccelerator needs to set up shared memory, and this can only be done when all php instances that need to access it are forks of the first process.

If I read that right, I can only use eaccelerator with mod_php and fastcgi with suexec but NOT with suPhp, right?

Is any of the other accelerators, i.e. x-cache able to work with all three?

till
3rd May 2009, 17:09
Is any of the other accelerators, i.e. x-cache able to work with all three?

No, there is no accelerator that works for cgi based setups like suphp.

Ovidiu
3rd May 2009, 18:31
k, thx. found out x-cache in the lenny repository is actually up to date, so I installed that one, changed the config a bit and all seems good...

Ovidiu
5th May 2009, 14:03
ok, all the smaller sites, running on suPhp have gone over to the new server very smoothly.

Now I have to move a pretty big one, which needs to run on fastcgi and suexec. What is there to configure or set up? who should own which files? Anything to take especial care about?

till
5th May 2009, 14:23
What is there to configure or set up?

nothing.

who should own which files?

The administrator / ftp user of the site as you have done it for suphp.

Anything to take especial care about?

no.

safoo
5th May 2009, 20:06
The wordpress update module can also connect to the site with ftp, so all of them will work.

But you should use either suphp or fastcgi with suexec.

I read up on why I should use fastcgi on my site and it does make sense. What is the performance difference for enabling suexec? Is enabling it primarily for security? If the only sites on the server are my own, any reason why I still need to enable suexec?

Thanks.

till
6th May 2009, 18:58
As far as I know, suexec does not makes any performance difference, it is a security function and ensures that the scripts are run under the correct user. Without enabling suexec your scripts will not be able to upload any files to the server directories without making them word writable.

Ovidiu
8th May 2009, 20:48
No, there is no accelerator that works for cgi based setups like suphp.

ok, after some testing, I decided to go with eaccelerator again. I jsut noticed that it won't be picked up after editing php.ini and restarting apache...

found this how-to, http://serversupportforum.de/forum/faqs-anleitungen/18518-how-php5-2-3-mit-suphp-eaccelerator-automatische-vhost-conf-f-r-plesk.html and this one http://wiki.dreamhost.com/EAccelerator both suggesting that one switches first to standard cgi mode, kills all fcgi processes then switches back...

isn't there a more elegant method? besides, is that all needed to be done?

Ovidiu
9th May 2009, 12:07
I guess its the same problem as with suPhp: accelerators seem not to work with fastcgi AND SUEXEC, right?

any other solutions?

the smal sites I am running with suPhp are fine, but there is this rather big one, running on fastcgi with suexec, that needs a littel bit more power...
if accelerators won't work, what else can one tune?

and btw. tuning the apache.conf file and the php.ini, which one does that influence suPhp, mod_php, fastcgi? Some tuning hints for each of these "modes"?

Ovidiu
9th May 2009, 12:51
here is another nice thread, worthwhile reading about these different modes: http://forums.cpanel.net/showthread.php?t=102617

I really think there is a huge speed problem, almost all wordpress sites I am hosting went from 0.2 seconds generation time to close to 0.9 seconds generation time with suPhp and to 0.45 with fastcgi :-(

Ovidiu
9th May 2009, 14:18
my mistake, it works actually, I was just laceing the eaccelerator admin script inside another vhosts, so I wasn't able to see anything :-) placeing it into the fastcgi vhost worked ;-) all is well...

Gimly
16th June 2009, 20:39
Hi all,

Is there a way to just proposing fast-cgi and suphp option to our client in ISPC3 and not cgi and mod_php ?

Thanks for your answers

till
16th June 2009, 20:40
Sure, just select it in the client limits ;)

bswinnerton
4th March 2010, 18:18
The php option depends on traffic that you expect for the site and if the site e.g. uploads or creates images or files on the server.

mod_php:

- fast
- runs not under admin user of the site
- well suited for low and high traffic sites, but not for cms systems like joomla.

suphp:

- not so fast
- script runs under web admin
- secure
- well suited for low traffic sites

fastcgi

- fast
- script runs under web admin
- secure
- well suited for high traffic sites

so basicalley the decision is, if a site is low traffic, use suphp. suphp spawns a new cgi process for every page request, but it does not use resources when no pages are requested. On the opposite fastcgi, the php processes are running permanently even if no page is requested, this is faster and fine for a high traffic site but for a small homepage with 100 pageviews per hour you would waste resources.

I think this should be in some sort of tooltip in the next version of ISPConfig for us noobs :)

007007
12th July 2010, 14:43
nice tips, thank you till

we can use APC with fast-cgi ? any tutorial for this ?

falko
13th July 2010, 20:15
we can use APC with fast-cgi ? any tutorial for this ?
Yes - this tutorial (although it's for Lighttpd) should give you the idea: http://www.howtoforge.com/integrating-apc-into-php5-and-lighttpd-debian-etch

007007
17th July 2010, 16:55
thx

another question :

http://img2.pict.com/90/74/ce/3802981/0/ispconfig.png

what means suexec, cgi, ssi ? we must enable them?

I just moved a big forum with a shared hosting to a dedicated server, and the page loading slower than before ....

MajorWinters
17th July 2010, 19:53
suexec: http://httpd.apache.org/docs/1.3/suexec.html#what
SSI (server side scripting language): http://en.wikipedia.org/wiki/Server_Side_Includes
CGI (Common Gateway Interface): http://httpd.apache.org/docs/1.3/howto/cgi.html