Database Reference
In-Depth Information
5. The browser requests the file containing the HTML page from the
server.
6. The server translates the URL into a path and file name.
7. The server notes that the URL points to a program and not a static file.
8. The server prepares the environment, creates the environment variables,
places user input in STDIN, and launches the script.
9. The script begins execution, reads the environment variables, and gets input
from STDIN.
10. At the conclusion of the execution, the script sends proper headers to
STDOUT.
11. The script places its output in STDOUT.
12. The script terminates.
13. The Web server recognizes the termination of the script and closes the con-
nection to the browser.
14. The browser displays the output from the script.
Advantages of CGI CGI has become the de facto standard for communication
of external applications with Web servers. The following is a listing of advantages
offered by CGI.
Generic interface. Provides a generic interface between Web servers and user-
designed applications accessing various types of data sources.
Simplicity. The only requirement for any program to be CGI-compliant is to
conform to the method for passing information to and from the script.
Coding in any language. CGI programs may be coded with any of the several pro-
gramming languages.
Server independence. A CGI program can be written in such a way that it will
execute without modification on any server running on the same operating system.
Platform independence. A CGI program can be kept portable by using a com-
monly available language and avoiding platform-specific code.
Problems with CGI CGI scripts tend to impose a heavy burden on Web servers.
The scripts are separate programs. The server process must initiate a new task for
every CGI script launched. Consider an enormously popular website. The Web
server will be launching numerous scripts for execution. Each task initiated by every
script uses system resources such as memory, disk space, and slices of processor time.
When many scripts have to execute almost simultaneously, the server can be quickly
bogged down. When scripts become large and complex, they take longer to load
and execute.
The Web server may also become a serious communications bottleneck. The com-
munication between a client and the database server must always go through the
Web server. The problem gets worse as the number of simultaneously executing
Search WWH ::




Custom Search