Common Gateway Interface

The form's data is sent to the web server within a HTTP request with a URL denoting a CGI script.

The web server then launches the CGI script in a new computer process, passing the form data to it.

Due to a necessity to run CGI scripts in a separate process every time the request comes in from a client, various alternatives were developed.

In 1993, the National Center for Supercomputing Applications (NCSA) team wrote the specification for calling command line executables on the www-talk mailing list.

A work group chaired by Ken Coar started in November 1997 to get the NCSA definition of CGI more formally defined.

As a result, mutual incompatibilities existed between different HTTP server variants that undermined script portability.

When the submit button is pushed the URI specified in the "action" attribute would be sent to the server with the data from the form sent as a query string.

While convenient, and required by many prepackaged scripts, it opens the server to attack if a remote user can upload executable code with the proper extension.

The script can then read these environment variables or data from standard input and adapt to the Web browser's request.

The CGI program retrieves the source of that entry's page (if one exists), transforms it into HTML, and prints the result.

For a high number of HTTP requests, the resulting workload can quickly overwhelm the Web server.

The computational overhead involved in CGI process creation and destruction can be reduced by the following techniques: The optimal configuration for any Web application depends on application-specific details, amount of traffic, and complexity of the transaction; these trade-offs need to be analyzed to determine the best implementation for a given task and time budget.

The official CGI logo from the spec announcement