OpenZone Logo

What is the Common Gateway Interface (CGI)?

Creating a web site can be done in many ways.

Common Gateway Interface

The CGI (Common Gateway Interface) is an interface specification that allows web servers to run an external program to process HTTP/S requests from users.

These programs are often written in a scripting language and are often referred to as CGI scripts, although they can also include compiled programs.

A typical usage example occurs when a user submits a form on a web page that uses CGI. The form is submitted to the web server via an HTTP request with a URL pointing to a CGI script. 

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

The output of the CGI script, usually in the form of HTML, is returned by the script to the web server, and the server forwards it to the browser in response to the browser’s request.

The CGI method, developed in the early 1990s, was the first to allow a web page to be interactive. However, due to the need to run CGI scripts in a separate process each time a request is received from a client, several alternatives were developed.

CGI is a method used to exchange data between the server and the web browser. It is a set of rules by which a program or script can send data to the web server, where it can be processed.

Common uses of CGI include:

▸ Guest readers.
▸ E-mail form
▸ Mailing list updates
▸ Blog