I searched for "dead clown" but all the pictures were too disturbing. I suppose that's kind of like the experience of trying to get classic ASP up and running with todays libraries |
There is a lot of old advice on the web and most of it was based on much older software versions, but I persevered and have finally managed to get classic ASP running on Apache 2.4 in Ubuntu.
The process will allow you to have a shot at getting your code running, but my best advice is to use a small Windows VM. There's no guarantee that your code will actually compile and run using this solution, and the effort required is hardly worthwhile.
The Apache module you're looking for is Apache::ASP. You will need to build it manually and be prepared to copy pieces of it to your perl include directories. You will also need to manually edit one of the module files.
The best instructions I found for getting Apache::ASP installed were on the cspan site. You'll find the source tarball on the cpan modules download page.
I'm assuming that you're able to install the pre-requisites and build the package by following those instructions. I was able to use standard Ubuntu packages and didn't have to build everything from source:
sudo apt-get install libapreq2-3 libapache2-request-perl
Once you've built and installed Apache::ASP you need to edit your apache.conf file to make sure it's loaded:
PerlModule Apache2::ASP
# All *.asp files are handled by Apache2::ASP
<Files ~ (\.asp$)>
SetHandler perl-script
PerlHandler Apache::ASP
</Files>
If you try to start Apache at this point you will get an error something like Can't locate Apache2/ASP.pm in @INC (you may need to install the Apache2::ASP module)
Unfortunately the automated installs don't place the modules correctly. I'm not a perl developer and didn't find an easy standard way to add an external path to the include path, so I just copied the modules into my existing perl include path. You'll find the requested files in the directory where you build Apache2::ASP
The next problem that I encountered was that Apache 2.4 has a different function name to retrieve the ip of the connecting request. You'll spot an error in your log like this : Can't locate object method "remote_ip" via package "Apache2::Connection".
The bug fix is pretty simple and is documented at cpan. You'll need to change line 85 of StateManager.pm. You'll find the file in the directory where you copied the modules into the perl include directory, and its location is in your error log.
# See https://rt.cpan.org/Public/Bug/Display.html?id=107118
Change line 85:
$self->{remote_ip} = $r->connection()->remote_ip();
To:
if (defined $r->useragent_ip()) {
$self->{remote_ip} = $r->useragent_ip();
} else {
$self->{remote_ip} = $r->connection->remote_ip();
}
Finally after all that my code doesn't run because of compile issues - but known good test code does work.
This is in no way satisfactory for production purposes, but does help in getting a development environment up and running.
Comments
Post a Comment