What Is It?

CGI, or Common Gateway Interface, is a standard for external gateway programs to interface with information servers such as HTTP servers. A CGI program is executed in real time so it can output dynamic information from a static HTML page.

Who Is it For?

CGI is useful for anyone who wants to handle the output of HTML forms with a CGI program. Unfortunately, any time that a program interacts with a networked client, the possibility exists of that client attacking the program to gain unauthorized access to a server. Since even the smallest script can present a danger to a system’s integrity, the user should learn about guidelines that will prevent that server from coming under malicious attack. With that said, many professionals prefer to write CGI scripts instead of programs, since they are easier to debug, modify, and maintain than a typical compiled program.

Features

A CGI program is executable by anyone who uses the CGI to run a program on a system. With this capability, CGI requires several safety measures to prevent a user from hacking the system. One measure is to deposit CGI programs in a special directory (CGI-bin), so that the Web server knows to execute the program rather than just display it to the browser. This directory is usually under direct control of a Webmaster or a Web manager who can prohibit the average user from creating CGI programs. There are other ways to allow access to CGI scripts, but it is up to professional users to set these up directly in the Web server. Some hosts do not allow CGI scripts to run on servers.

One example of a CGI program is a Wiki implementation. The user agent requests the name of an entry; the server will retrieve the source of that entry’s page (if one exists), transform it into HTML and then send the result back to the browser. Or, it will prompt the user to create the result.

Compatibility

CGI programs can be written in any language that allows it to be executed on a system, such as C/C++, Fortran, Perl, TCL, any UNIX shell, Visual Basic or AppleScript. The lanuguage used depends upon what is available on a system. The CGI-SRC directory that comes with server distributions usually will provide the source code from some CGI programs in the CGI-bin directory. Otherwise, a scripting language such as Perl, TCL, or a UNIX shell can simply reside in the directory since there is no associated source code.

Featured Web Hosts that Offer CGI

All Web Hosts that Offer CGI