Site home page
(news and notices)

Get alerts when Linktionary is updated

Book updates and addendums

Get info about the Encyclopedia of Networking and Telecommunicatons, 3rd edition (2001)

Download the electronic version of the Encyclopedia of Networking, 2nd edition (1996). It's free!

Contribute to this site

Electronic licensing info



CGI (Common Gateway Interface)

Related Entries    Web Links    New/Updated Information

Search Linktionary (powered by FreeFind)

Note: Many topics at this site are reduced versions of the text in "The Encyclopedia of Networking and Telecommunications." Search results will not be as extensive as a search of the book's CD-ROM.

CGI is a server extension that extends the capabilities of Web servers. You write server extensions to make your Web site more active and interesting. Instead of delivering a stale static page, CGI (and other server extensions) lets Web clients request information from Web servers. The user fills out a form that is submitted to the server. The server uses the submitted information to query a database or as input to a program. The results are then used to build a custom Web page and send it to the client. Note that there is no "back-and-forth" information between the server and client. A user must fill out a form and submit it. Blank fields or fields with incorrect information must be detected, and the client must be asked to resubmit the form.

CGI is nonconversational. It is not possible to stop in the middle of processing data from a Web browser and go back to the Web browser to ask for data to be corrected. CGI allows only for data to be input. The CGI processes the data, produces output, and then terminates. If a gateway needs to have data corrected, it can only run to completion and then start over when the data is re-presented by the Web server.

The CGI interface is the protocol that provides a two-way interface between Web clients and Web servers and the CGI script is the set of commands that determines what happens when they communicate. CGI was invented to extend the HTTP protocol. It consists of the following:

  • The CGI control tags and field specifiers to be placed in HTML documents

  • Environment variables in memory where the server places information used by scripts

  • The flow of information between client, server, and script.

The steps that Web site developers follow to use CGI are to first create the HTML (Hypertext Markup Language) form and add the tags that define the input boxes, drop-down list boxes, and buttons that appear on forms to collect input from users. Next, a CGI script is written to accept the input that the end user types on the HTML form and do something with it, like make a query to a back-end database. Perl is a scripting and reporting tool that many programmers use to build CGI scripts. Refer to "Perl."

CGI is notoriously slow, so Open Market created a protocol called FastCGI to address the problem. FastCGI eliminates the need for servers to create address spaces every time it needs to run CGI by maintaining a pool of available CGI processes that are always available.

For more information on gateways, forms, and CGI, refer to the Web pages listed on the related entries page, or refer to books on Web server design. Many books include disks that contain sample programs for collecting common information from Web clients.

Copyright (c) 2001 Tom Sheldon and Big Sur Multimedia.
All rights reserved under Pan American and International copyright conventions.