The steering wheel, the faucet knob, and the remote control are all common interfaces to everyday objects: cars, running water, the television.
Why then, with a name like the Common Gateway Interface, is CGI so elusive? Common? What's so common about CGI? and A gateway to what? are the obvious questions. The answers lie in the continual effort to extend the functionality of information servers, particularly those used on the World Wide Web.
The Common Gateway Interface is simply this: a way of passing information between an information server and some other program. The other program is called a "gateway" because it often sits between the information server and another resource, such as a database.
CGI adds to the functionality of an information server without having to change the server itself. Once a server implements the interface, new capabilities can be added through the use of new gateways, which from here on will be referred to as CGI programs.
CGI Programs:
CGI programs can be written in any programming or scripting language available on the system running the information server. Perl, C/C++, Java, TCL, Unix shell, Visual Basic and AppleScript are all languages used to write custom CGI programs on various platforms.
CGI programs often query databases or call other applications, converting results into a format meaningful to the server and to clients (think Web browsers) using the server.
Warning: CGI programs can introduce security holes into otherwise secure systems. When a CGI program is written poorly, commands can be hidden in the input and change the behaviour of the program. Files could be modified or destroy through such an exploit. So be careful when you write CGI programs. And be extra careful when copying them from others.
CGI Resources: