Common Gateway Interface

Michael Courage and Stephen Manley
{courage, manley}@eecs.harvard.edu

Definition

The Common Gateway Interface is the standard method for generating dynamic documents with a WWW server. When a user requests a dynamic document the server runs a program (often called a CGI script) that generates the page. Common applications of CGI scripts include search engines, hit counters, and redirection.

How it works

On a Unix system the server runs a CGI script by calling fork and exec. The server sends input to the script through a pipe (attached to the script's standard input) and through environment variables. The script then sends its result to standard output (attached to another pipe on the server). The server parses the output, and sends it back to the client.

More Info

For more detailed information on the CGI standard see http://hoohoo.ncsa.uiuc.edu/cgi/.
Michael Courage / courage@eecs.harvard.edu