ASP On Apache

So finally one of our clients wanted to be able to put ASP pages on his site which we are hosting on our Apache 2 server. This required a bit of research, but eventually we found that it should be pretty painless to get the Apache::ASP perl module installed. Which indeed was very simple, using the guide at all we needed to do was:

perl -MCPAN -eshell
This put us into CPAN, after filling out the config options we tried:

install CPAN

install Bundle::Apache::ASP

This installed all the modules and dependencies we needed to get ASP working, or so we thought. You also need mod_perl, which normally would be installed using apt or from a deb or rpm. As we rolled our own Apache it wasn’t quite so easy. We had to build mod_perl, you can do it in CPAN, but I couldn’t get it to install properly when I did that. I downloaded the latest version of the source code from , if you are running Apache 1.3 you need version 1.0 of mod_perl for Apache2 you need version 2.0 of mod_perl. At this point its worth noting that you will need the libperl-dev library installed, as you will need it for the tests to pass later. With all the required libraries installed it was time to configure the module, the configuration depends on how Apache was configured so for my installation I had to use:

perl Makefile.PL MP_APXS=/usr/local/apache/bin/apxs MP_AP_CONFIGURE=”–with-mpm=prefork –enable-dav –enable-so”

This tells the module where my apxs binary is and what options were used when Apache was configured and built. Once configuration is finished, build the module with make and then shutdown all instances of Apache that maybe running before running make test, by running this you ensure that the module has been built correctly. Assuming that runs through without any errors then as root run make install to put everything where it should be. Assuming the location of the APXS binary was correct during configure you should find it has successfully installed itself in the modules directory of your Apache installation.

Now it gets a bit more fiddly, you may get an error when starting Apache after the install that make_sock cannot bind to port 80. This is due to the the way Apache forks its processes and doesn’t always kill them off when it shuts down. If you get this message then use:

killall -9 httpd

This will kill all instances of Apache that are running.

The following line was also required in http.conf:

LoadModule perl_module modules/
At this point starting up Apache should load up mod_perl and the ASP module, however, we were still getting Server 500 errors. A quick check of the logs revealed it was throwing an error about method “get” in module “APR::Table”. Google revealed that the problem was that Apache needed to be told to use the Apache2::compat module. The easiest way to do this was to create a file in the Apache conf directory which contained the following:


use Apache2::compat;

Then add the following line to httpd.conf:

PerlRequire /usr/local/apache/conf/

Restart Apache and you should be able to view ASP pages without a problem. Our client still had problems, but that was due to him not knowing how to write ASP, not our problem!!!