Introduction to the CGI
What is it?
The Common Gateway Interface, or CGI, is an interface for running
external programs, or gateways, under an information server.
Currently, the supported information servers are HTTP servers.
What's a gateway used for?
What we refer to as gateways are really programs which handle
information requests and return the appropriate document or generate a
document on the fly. With CGI, your server can serve information which
is not in a form readable by the client (such as an SQL database), and
act as a gateway between the two to produce something which clients
can use.
Gateways can be used for a variety of purposes, the most common being
the handling of ISINDEX and FORM requests for HTTP.
Some examples of the uses of CGI:
- Converting your system's manual pages into HTML on the fly and
sending the HTML result to the client.
- Interfacing with WAIS and archie databases, converting the
results to HTML and sending the result to the client.
- Allowing user feedback about your server through an HTML form and
an accompanying CGI decoder.
What exactly are gateway programs?
Gateway programs, or scripts, are executable programs which can be run
by themselves (but you wouldn't want to). They have been made external
programs in order to allow them to run under various (possibly very
different) information servers interchangably.
What language can I write these gateways in?
Gateways conforming to this specification can be written in any
language which produces an executable file.
Some of the more popular languages to use include:
- C/C++
- PERL
- TCL
- The Bourne Shell
- The C Shell
There are many others.
Who came up with it?
The specification was discussed between the main HTTP server authors.
Credits go to:
- Tony Sanders sanders@bsdi.com
- Ari Luotonen luotonen@ptsun00.cern.ch
- George Phillips phillips@cs.ubc.ca
- John Franks john@math.nwu.edu
as well as countless others.
Return to the overview
Rob McCool
robm@ncsa.uiuc.edu