Re: php running as module or cgi?

From: Date: Thu, 11 Nov 2010 19:14:05 +0000
Subject: Re: php running as module or cgi?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-309454@lists.php.net to get a copy of this message
On 11/11/2010 12:04 PM, Richard Quadling wrote:
On 11 November 2010 00:46, Al<news@ridersite.org> wrote:
Briefly, what are the trade offs on a typical shared host? I've done a little research and can't seem to find anything outstanding either way. Seems like as an Apache module is faster. This argument makes sense. CGI is more secure, this argument doesn't seem too persuasive to me. Maybe I'm missing something. Thanks....
As a module, any misbehaving script is running within the same space as all the other scripts. If a script is able to knock out PHP (for any reason), all the script go. With CGI, they are run in separate spaces. No direct communication (unless the scripts are sharing memory by some way). If a script knocks out PHP, that script dies. Everything else keeps on going. The main downside to CGI (as I understand things), is that for each invocation of the script, PHP has to do the complete build up and tear down every single time. For every single script. With FastCGI, when the server starts, a pool of ready to go php instances are created. So a script is called, the build up part is already done. In terms of speed, I'd guess you'd have to be working pretty hard to see the difference between module/isapi and fast-cgi.
If I am not mistaken, An apache module can even bring down the whole web server if it really misbehaves. So this leaves the choice between CGI & FatsCGI. CGI setup/teardown is only an issue for site with a fairly high traffic. It really depends on the type of site you intend to build.

« previous php.general (#309454) next »