Apache::ASP -- Setup
July 17, 2000
What attracted me first to Apache::ASP was its ability to use scripts which
were already written with the CGI.pm module. I had a number of scripts which
interacted with forms via CGI, and there was no good reason to re-write
these scripts for a new model of form interaction. Yet, I wanted to move
these scripts into both a mod_perl environment and, ideally, an embedded
environment where an HTML template could be "wrapped around" the
output of the scripts.
A nice benefit of this embedded model was that we could create a variety of
"results page templates", each with a different page design, yet
each containing an embedded call to the same processing script. Apache::ASP
seemed to be the only embedded Perl solution that would let us migrate these
scripts into an embedded environment without modification. How sweet it was.
To begin using Apache::ASP, you must download and install the module. Doing
this does first require that you have already installed the Apache web
server with mod_perl support. The most recent version of the
Apache::ASP module can always be found at
The module archive contains the very simple installation instructions.
Installation is refreshingly easy.
Apache::ASP is configured via the .htaccess file, which must reside
at the top of the web tree you wish to be ASP-enabled. For instance, if your
Apache document root folder is /www/htdocs/, then you'll need to
configure Apache::ASP in /www/htdocs/.htaccess. The module includes
a sample .htaccess configuration file in the site/eg directory
of the installation archive.
The Apache web server, however, will ignore the .htaccess file unless
you enable its use, via the Apache configuration script at
/your/apache/conf/httpd.conf
(depending on where your Apache is installed). Somewhere in httpd.conf
there will be a config section for the web tree in question, and here you
must enable "AllowOverride All". for example:
<Directory "/www/htdocs">
Options FollowSymLinks ExecCGI Includes
AllowOverride All Order allow,deny
Allow from all </Directory>
Now, when Apache follows a document in the named directory, it will heed any
configuration directive in the .htaccess file in that directory.
While developing your scripts, it is a good idea to enable the
StatINC and Debug variables for Apache::ASP, which means
adding the following lines to .htaccess:
PerlSetVar StatINC 1 PerlSetVar Debug 1
The StatINC variable will tell Apache::ASP to reload any changed
pages and scripts on each invocation, rather than rely on a cached,
pre-compiled copy. As you can imagine, this will reduce performance, but
will ease development as you code pages and scripts, without having to
restart the Apache server for every modification. The Debug variable
will output error messages to the Apache server log. Once the pages are
ready to go live and into production, remember to disable StatINC
(set it to 0), consider disabling debugging to prevent the log from
inflating grossly, and restart the Apache server to affect changes to
.htaccess.
Embedding Perl
The Perl You Need to Know
Apache::ASP -- CGI Migration
|