setting up php environment

what is the difference on setting up php environment as CGI or as a module to a web server
gmeltsin1Asked:
Who is Participating?
 
bombozamaConnect With a Mentor Commented:
Quoted from http://www.faqts.com/knowledge_base/view.phtml/aid/111:

"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:
http://www.htaccesselite.com/difference-between-php-cgi-and-php-as-an-apache-module-vt106.html
http://www.webmasterworld.com/forum88/3645.htm
http://ca.php.net/manual/en/security.cgi-bin.php
http://ca.php.net/manual/en/security.apache.php

Hope it helps
0
 
Adam314Commented:
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.

0
All Courses

From novice to tech pro — start learning today.