Information about Common Gateway Interface

The Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with an information server, commonly a web server. This allows the server to pass requests from a client web browser to the external application. The web server can then return the output from the application to the web browser.

History

CGI arose out of discussions on the www-talk mailing list between Rob McCool, John Franks, Ari Luotonen, George Phillips and Tony Sanders in 1993. Rob McCool, working at NCSA, drafted the initial specification and provided a reference implementation in the NCSA HTTPd web server using environment variables to store parameters passed from the web server execution environment before spawning the CGI program as a separate process.

Example

An example of a CGI program is the one implementing a wiki. The user agent requests the name of an entry; the server will retrieve the source of that entry's page (if one exists), transform it into HTML, and send the result back to the browser or prompt the user to create it. All wiki operations are managed by this one program.

Implementation

The way CGI works from the Web server's point of view is that certain locations (e.g. http://www.example.com/wiki.cgi) are defined to be served by a CGI program. Whenever a request to a matching URL is received, the corresponding program is called, with any data that the client sent as input. Output from the program is collected by the Web server, augmented with appropriate headers, and sent back to the client.

Because this technology generally requires a fresh copy of the program to be executed for every CGI request, the workload could quickly overwhelm web servers, inspiring more efficient technologies such as mod_perl or PHP that allow script interpreters to be integrated directly into web servers as modules, thus avoiding the overhead of repeatedly loading and initializing language interpreters. However, this is only applicable for high-level languages that need interpreters. Such overloads can be avoided by utilizing languages like C. By using C or similar compiled languages it is possible to reach higher efficiency levels, because such programs terminate their execution cycle faster than interpreted languages with less operating system overhead. Even better, RPG programs on the IBM iSeries/AS400 may stay resident in memory with databases already open, allowing for faster execution on subsequent usage. The optimal configuration for any web application will obviously depend on application-specific details, amount of traffic, and complexity of the transaction; a software engineer analyzes these tradeoffs to determine the best implementation for a given task and budget.

Web servers often have a cgi-bin directory at the base of the domain, to hold executable files.

Workarounds for scripting languages

The overhead of spawning new processes to compile the server code can be easily handled if the code is only changed occasionally. One example is FastCGI, while others include programming accelerators that take a web script when initially called and store a compiled version of the script in a system location so that further requests for the file are automatically directed to the compiled code instead of invoking the script interpreter every time the script is called. When scripts are changed, the temporary accelerator cache can be emptied to ensure that the new script is called instead of the old one. Thus for languages such as C or Pascal or RPG, which are usually compiled anyway, CGI programs are no different from other programs in this regard, and require no special processing. Another approach used for scripting languages is to embed the interpreter directly into the web server so that it can be executed without creating a new process. Modern web servers like Apache or Cherokee have a number of modules for Perl, PHP, Python and Ruby which do this.

References

See also

External links

standardization or standardisation can have several meanings depending on its context. Common use of the word standard implies that it is a universally agreed-upon set of guidelines for interoperability.
..... Click the link for more information.
protocol is a convention or standard that controls or enables the connection, communication, and data transfer between two computing endpoints. In its simplest form, a protocol can be defined as the rules governing the syntax, semantics, and synchronization of communication.
..... Click the link for more information.
Application software is a subclass of computer software that employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform. This should be contrasted with system software which is involved in integrating a computer's various capabilities,
..... Click the link for more information.
Server Computer

The inside/front of a server computer

Connects to:
  • Internet via one of

..... Click the link for more information.
web server can mean one of two things:
  1. A computer program that is responsible for accepting HTTP requests from clients, which are known as web browsers, and serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and

..... Click the link for more information.
A client is an application or system that accesses a (remote) service on another computer system known as a server by way of a network. The term was first applied to devices that were not capable of running their own stand-alone programs, but could interact with remote computers
..... Click the link for more information.
A web browser is a software application that enables a user to display and interact with text, images, videos, music and other information typically located on a Web page at a website on the World Wide Web or a local area network.
..... Click the link for more information.
Robert M. McCool (born 1973), more commonly known as Rob McCool, is a software developer and architect.

McCool was the author of the original NCSA HTTPd web server, later known as the Apache HTTP Server, and to this day httpd.
..... Click the link for more information.
National Center for Supercomputing Applications (NCSA) is one of five original centers in the National Science Foundation's Supercomputer Centers Program and a unit of the University of Illinois at Urbana-Champaign.
..... Click the link for more information.
The NCSA HTTPd was a web server originally developed at the NCSA by Robert McCool and a list of others . It was among the earliest web servers developed, following Tim Berners-Lee's first web server developed at CERN, Tony Sanders' Plexus server, and some others.
..... Click the link for more information.
Environment variables are a set of dynamic values that can affect the way running processes will behave on a computer.

Synopsis

In all Unix and Unix-like systems, each process has its own private set of environment variables.
..... Click the link for more information.
In computing, a process is an instance of a computer program that is being sequentially executed.[1] While a program itself is just a passive collection of instructions, a process is the actual execution of those instructions.
..... Click the link for more information.
HTML (Hypertext Markup Language)

File extension: .html, .htm
MIME type: text/html
Type code: TEXT
..... Click the link for more information.
Uniform Resource Locator (URL) formerly known as Universal Resource Locator, is a technical, Web-related term used in two distinct meanings:
  • In popular usage, many technical documents, it is a synonym for Uniform Resource Identifier (URI);

..... Click the link for more information.
PHP

Paradigm: imperative, object-oriented
Appeared in: 1995
Designed by: Rasmus Lerdorf
Developer: The PHP Group
Latest release: 5.2.4/ 30 August 2007
Typing discipline: Dynamic, weak (duck typing)
Influenced by: C, Perl
Java, C++, Python
..... Click the link for more information.
A high-level programming language is a programming language that, in comparison to low-level programming languages, may be more abstract, easier to use, or more portable across platforms.
..... Click the link for more information.
C

The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language.
..... Click the link for more information.
Software engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software.[1] The term software engineering
..... Click the link for more information.
FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle
..... Click the link for more information.
In computing, the term accelerator has multiple meanings:
  • Hardware accelerator, an additional unit of hardware to perform some function faster than is possible in software running on the normal CPU.

..... Click the link for more information.
compiler is a computer program (or set of programs) that translates text written in a computer language (the source language) into another computer language (the target language).
..... Click the link for more information.
In computing, the term accelerator has multiple meanings:
  • Hardware accelerator, an additional unit of hardware to perform some function faster than is possible in software running on the normal CPU.

..... Click the link for more information.
C

The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language.
..... Click the link for more information.
Pascal is a structured imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming. A derivative known as Object Pascal was designed for object oriented programming.
..... Click the link for more information.
Apache HTTP Server, commonly referred to simply as Apache, is a web server notable for playing a key role in the initial growth of the World Wide Web. Apache was the first viable alternative to the Netscape Communications Corporation web server (currently known as Sun Java
..... Click the link for more information.
Cherokee HTTP Server is a cross-platform Web server. It aims to be fast and fully-functional while remaining lightweight compared to alternative servers. It is written entirely in C. It is embeddable and extensible with plugins.
..... Click the link for more information.
FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle
..... Click the link for more information.
qDecoder is a Web Application Interface C/C++ library giving transparent access to GET/POST/FILE/COOKIE values, Session handling, Config file parsing, and various connection, string, search, SED, AWK and file handling functions.
..... Click the link for more information.
Simple Common Gateway Interface (SCGI) — a protocol for applications to interface with HTTP servers, an alternative to the CGI protocol. It is similar to FastCGI but is designed to be easier to implement.
..... Click the link for more information.
FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus


page counter