What is CGI?

Usually an http server is called by a browser to serve some html pages which are static*




The Common Gateway Interface (CGI) is a standard for interfacing external applications with information servers, such as HTTP or Web servers. A plain HTML document that the Web daemon retrieves is static*: a text file that doesn't change.
A CGI program, on the other hand, is executed on-the-fly, so that it can output dynamic information.
For instance, a CGI program can interact with a database or search information on the web and create dynamic HTML pages with dynamic content.




* This is partially true : the http server can be configured in order to execute by itself some shell commands which are included in html pages: in this case the html page is a Server Side Include (SSI) page and is very often called an shtml page.