|
CGI
- common gateway interface:
A
standard way of communicating between different processes
in a Web HTTP server.
Not a programming language, but a specification for transferring
information between a World Wide Web server and a CGI program.
External programs are called gateways because they open up
an outside world of information to the server.
CGI
scripts:
Interface
external applications with information servers.
Executed by the server in response to user actions.
CGI scripts are often written in C++ or Perl, but can be written
in any language that can be executed on the host system.
A
CGI program is any program designed to accept and return data
that conforms to the CGI specification.
CGI
programs:
Run
in real-time on the server.
Script can process information submitted by a client and dynamically
generate a page that is based on input.
Because UNIX was the operating system on early servers, CGI
scripts conform to standards set by UNIX applications.
Programs are stored in a special directory, often called /cgi-bin
CGI
popularity:
Many
prewritten scripts are freely available, the majority of them
for a variety of platforms and for most of the popular Web
servers.
CGI
drawbacks:
Each time a CGI script is spawned, it creates an additional
process on the server machine, slowing the server's response
time.
If the CGI script is not set up correctly, security holes
can occur on the server, rendering the Web site vulnerable
to attacks by hackers.
Another problem is that it is difficult to maintain state--that
is, to preserve information about the client from one HTTP
request to the next.
How
CGI works:
Each
time a user views the page and submits the form, the data
travels from the Web browser to the CGI script.
The CGI script then processes the data and returns any results
to the user in the form of a new HTML-based Web page.
This happens every time a user makes changes to the Web form
CGI
lets Webmasters add common features, such as counters and
date/time displays, online order forms, chat pages, and search
engines.
When
you see this directory in your web browser's URL window, cgi-bin,
it's a sign that you're running a CGI program, such as a search
tool, cgi-bin stand for CGI binary
Common
uses of CGI-
Collect
data from a web page and save it in a file.
Perform calculations on the data and display the results.
Permit access to a site based on a user name and password.
Process form data for product orders, or surveys.
Working with a Perl script
|