NYCPHP Meetup

NYPHP.org

[nycphp-talk] "mod PHP" vs. PHP

Chris Snyder csnyder at chxo.com
Thu Jun 3 13:38:00 EDT 2004


Jayesh Sheth wrote:

> what's the difference between "mod PHP" and PHP? 


I'll take a stab at this, but only because no one else has said it quite 
this way.

mod_php is a nickname for PHP compiled as an Apache module, whereas PHP 
(cli or cgi) refers to the standalone interpreter.

The functional difference is that mod_php is available within every 
httpd process. When Apache encounters a PHP script, it hands it off to 
its internal module for processing, then puts the output on the wire.

Standalone (cgi) PHP is run as a separate process: when Apache 
encounters a PHP script, it executes PHP as a command, passing the 
script and the $_SERVER environment. When suexec is involved, Apache 
runs the php command with the same uid as the owner of the script. The 
separation of processes allows the separation of powers. My 
understanding is that this is slightly less efficient, but it's 
certainly safer.



More information about the talk mailing list