Datasheet

“main” (Installation and Administration) 2004/6/25 13:29 page 542 #568
i
i
i
i
i
i
i
i
Apache offers three ways of generating active contents:
Server Side Includes (SSI) These are directives that are embedded in an
HTML page by means of special comments. Apache interprets the
content of the comments and delivers the result as part of the HTML
page.
Common Gateway Interface (CGI)
These are programs that are located in certain directories. Apache
forwards the parameters transmitted by the client to these programs
and returns the output of the programs. This kind of programming
is quite easy, especially since existing command-line programs can
be designed in such a way that they accept input from Apache and
return their output to Apache.
Module Apache offers interfaces for executing any modules within the
scope of request processing. Apache gives these programs access
to important information, such as the request or the HTTP headers.
Programs can take part in the generation of active contents as well as
in other functions (such as authentication). The programming of such
modules requires some expertise. The advantages of this approach
are high performance and possibilities that exceed those of SSI and
CGI.
While CGI scripts are executed directly by Apache (under the user ID
of their owner), modules are controlled by a persistent interpreter that is
embedded in Apache. In this way, separate processes do not need to be
started and terminated for every request (this would result in a consider-
able overhead for the process management, memory management, etc.).
Rather, the script is handled by the interpreter running under the ID of the
web server.
However, this approach has a catch. Compared to modules, CGI scripts are
relatively tolerant of careless programming. With CGI scripts, errors, such
as a failure to release resources and memory, do not have a lasting effect,
because the programs are terminated after the request has been processed.
This results in the clearance of memory that was not released by the pro-
gram due to a programming error. With modules, the effects of program-
ming errors accumulate, as the interpreter is persistent. If the server is not
restarted and the interpreter runs for several months, the failure to release
resources, such as database connections, can be quite disturbing.
542 22.9. Active Contents