Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php as apache module or CGI?

whats the trade off?



11:45 am on Apr 28, 2004 (gmt 0)

10+ Year Member

What are the differences between setting up php to run through an apache module or through the CGI processor?

I can see that if you want to run php scripts from the command line then you need to use the executable option, but what, if any, advantages do you gain from running it through the apache module?

Performance? Scalability?


4:49 pm on Apr 28, 2004 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

speed and power

take a look at these as well
Installed as CGI binary [ca.php.net]
Installed as an Apache module [ca.php.net]

You have a lot more options with a fair number of functions and configuration in general if it is run as a module.

given that on the php site they often refer to installation this way

PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.

cgi would be the last option, if you can't install it as a module.

Personally, if I have the option, I would never install php as cgi. In the hundreds of sites I have worked with only 1 has been set up this way and that was a few years ago.


5:51 pm on Apr 28, 2004 (gmt 0)

10+ Year Member

speed and power

There is still the option of FastCGI, which from what I have heard is about as fast as PHP as a module.


5:56 pm on Apr 28, 2004 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

cgi by any other name is still..




4:59 am on Apr 29, 2004 (gmt 0)

10+ Year Member

Personally I stay with module creation, and watch my code on security issues. I feel that if I'm relying on a particular setup to give my code the proper security level, then I'm looking for a cyber-black-eye.

The reason I stay with module is that most ISP's I work with, don't install PHP as a CGI option, so it is usless to the customer to design it that way. FastCGI is cool, but so is compiled PHP from a module install (which then passes FastCGI once again .. IME).

webadept --out


9:11 am on Apr 30, 2004 (gmt 0)

10+ Year Member

Thanks for the info all, and particularly for the security links.

I'm just getting my feet wet with php so info like this is very useful.


Featured Threads

Hot Threads This Week

Hot Threads This Month