Datasheet
“main” (Installation and Administration) — 2004/6/25 — 13:29 — page 544 — #570
i
i
i
i
i
i
i
i
22.9.4 Languages for CGI
Theoretically, CGI programs can be written in any programming language.
Usually, scripting languages (interpreted languages), such as Perl or PHP,
are used for this purpose. If speed is critical, C or C++ may be more suit-
able.
In the simplest case, Apache looks for these programs in a specific di-
rectory (cgi-bin). This directory can be set in the configuration file, de-
scribed in Section 22.7 on page 536).
If necessary, additional directories can be specified. In this case, Apache
searches these directories for executable programs. However, this repre-
sents a security risk, as any user will be able to let Apache execute pro-
grams (some of which may be malicious). If executable programs are re-
stricted to cgi-bin, the administrator can easily see who places which
scripts and programs in this directory and check them for any malicious
intent.
22.9.5 Generating Active Contents with Modules
A variety of modules is available for use with Apache. The term “mod-
ule” is used in two different senses. First, there are modules that can be
integrated in Apache to handle specific functions, such as modules for
embedding programming languages. These modules are introduced below.
Second, in connection with programming languages, modules refer to an
independent group of functions, classes, and variables. These modules are
integrated in a program to provide a certain functionality, such as the CGI
modules available for all scripting languages. These modules facilitate the
programming of CGI applications by providing various functions, such as
methods for reading the request parameters and for the HTML output.
22.9.6 mod_perl
Perl is a popular, proven scripting language. There are numerous modules
and libraries for Perl, including a library for expanding the Apache con-
figuration file. The home page for Perl is http://www.perl.com/. A
range of libraries for Perl is available in the Comprehensive Perl Archive
Network (CPAN) at http://www.cpan.org/.
544
22.9. Active Contents










