What is CGI (Common Gateway Interface)?

Posted: (EET/GMT+2)

 

If you need to generate dynamic web pages, and your web server supports it, you might want to try the Common Gateway Interface (abbreviated CGI).

CGI allows a web server to execute an external program in response to an HTTP request. A typical CGI request looks like this:

Browser > HTTP Request > Web Server > CGI Program > HTML Response

The web server starts the CGI application and passes request information through environment variables and standard input. The CGI program generates an HTML document and writes it to standard output, which the web server returns to the browser.

CGI applications can be written in C, C++, Perl, or other programming languages. Delphi should work, too. Although starting a new process for every request introduces some overhead, CGI provides a simple and portable way to create dynamic web applications.

CGI is useful when building early database-driven web sites before technologies such as ASP became widely available.

The CGI is specified by the NCSA (National Center for Supercomputing Applications). Hope this helps!