A CGI script is a program or script that is executed once for each
request for it. The CGI script is either identified by file extension,
for example .cgi, or by residing in a certain directory, for
example /cgi-bin/. A request to a CGI script will be handled
by finding the script and starting it with information about the
request sent as environment variables and data on stdin. The script
returns data by writing it to stdout.
The CGI script needs to be an executable file on the operating
system. On Unix this is either a program, or a script that begins with
#! followed by the name of the interpreter. On Windows this
is either a program or a file with an extension bound to the suitable
interpreter.