setting up php environment

what is the difference on setting up php environment as CGI or as a module to a web server
Who is Participating?
bombozamaConnect With a Mentor Commented:
Quoted from

"CGI is just an interface to execute a program. When you use php this way, the web server starts up the php binary and feeds it the php script (more or less...). PHP starts up, parses the file, returns the static html output and then shuts down.

With the module, php is no longer a seperate program. It is linked with apache so that apache and php run together as a single program. This way, when the webserver get's a request for the script, apache interperates it natively. Saves the high overhead of starting and killing the interperator each time."

You can read some more in these:

Hope it helps
As a seperate program, apache will start the php binary program, and tell it what script to run.  Apache will provide it some information (the CGI environment).  The php program will write to standard ouput the output from the script.  Apache will take that output, and send it to the client (eg: web browser).

As a module, the php interpreter behaves like a function that apache can call.  When used like this, the main php interpreter is loaded into memory once, and the processing of the php scripts happens inside the module.

All Courses

From novice to tech pro — start learning today.