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:


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:

There are many others.


Who came up with it?

The specification was discussed between the main HTTP server authors. Credits go to:

as well as countless others.


Return to the overview