ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

9.3 Cgi-bin Server-side Scripts and Programs

This document is a brief introduction to the Common Gateway Interface. For more detailed information see the extensive NCSA documentation, found here.

The CGI (Common Gateway Interface) is the standard by which external programs (often called gateways, or gateway programs) can interface with a HTTP (Web) server. Thus CGI programs act as gateways between the HTTP server and databases, or between the server and local programs or document generators. An illustration of how this all works is found in the following Figure:

graphical illustration of information flow between servers and CGI programs
An illustration of the way in which gateway programs communicate with Web (HTTP) servers and with the Web

For example, a CGI program can be designed to handle an information request to a database, take the results and assemble an HTML document from it, and return this document to your browser. Consequently CGI gateway programs are used to process information obtained via ISINDEX, FORMS or ISMAP (active image map) requests to an HTTP server.

With NCSA HTTP servers the CGI programs and scripts are placed in a special directory often named cgi-bin -- there may in fact be many of these directories, with names such as cgi-bin, cgi-stuff, htbin, and so on. The cgi-bin directory is often referenced by URLs like http://stuff.cc.dd/cgi-bin/. Therefore whenever you see this type of url you can expect that a gateway program is being referenced.

The NCSA documentation described in detail how to write these scripts, and mentions important ** security issues **. Please read the NCSA CGI documentation. For an overview of the CGI mechanisms and the HTTP protocol see our CGI Overview documentation.


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998