Serving ASP pages in Linux
I never intended to do such a thing as what the title describes. However, since we need it at work temporarily, I have to crack up my linux skills to set this up. Principal reference is http://www.apache-asp.org/config.html.
In Debian,
- install libapache2-mod-perl2 + libapache-asp-perl
<br />
sudo apt-get install libapache2-mod-perl2<br />
sudo apt-get install libapache-asp-perl<br />
- configuration includes:
sudo vi /etc/apache2/sites-available/default
76 PerlModule Apache::ASP 77 <files> 78 SetHandler perl-script 79 PerlHandler Apache::ASP 80 PerlSetVar Global . 81 PerlSetVar StateDir /data/asp 82 </files> |
-
Restart apache.
-
Make sure you have the correct permissions to: /data/asp
<br /> drwxrwxr-x 4 www-data www-data 4096 2007-11-13 15:33 asp<br />
-
If you encounter the problems:
[Tue Nov 13 15:12:36 2007] [error] [client 127.0.0.1] Can't locate object method "get" via package "APR::Table" at /usr/share/perl5/Apache/ASP.pm line 2016.\n at /usr/share/perl5/Apache/ASP.pm line 2016\n\tApache::ASP::get_dir_config('APR::Table=HASH(0x81d96f8)', 'Global') called at /usr/share/perl5/A pache/ASP.pm line 275\n\tApache::ASP::new('Apache::ASP', 'Apache2::RequestRec=SCALAR(0x81d9764)', '/data/wwwroot/asp/test.asp') called at /usr/share/pe rl5/Apache/ASP.pm line 183\n\tApache::ASP::handler('Apache2::RequestRec=SCALAR(0x81d9764)') called at -e line 0\n\teval {...} called at -e line 0\n, re ferer: http://127.0.0.1/asp/ |
Read nable-post. which patches /usr/share/perl5/Apache/ASP.pm as follows:
The lines 65-71: if($ENV{MOD_PERL}) { $ModPerl2 = ($mod_perl::VERSION >= 1.99); if($ModPerl2) { eval "use Apache::ASP::ApacheCommon ();"; die($@) if $@; } } become if($ENV{MOD_PERL}) { $ModPerl2 = ($mod_perl::VERSION >= 1.99); my $ver = $mod_perl::VERSION; if ($ver eq "") { $ver = $ENV{MOD_PERL_API_VERSION}; } $ModPerl2 = ($ver >= 1.99); if($ModPerl2) { eval "use Apache::ASP::ApacheCommon ();"; die($@) if $@; } } |
- If Step 5 still doesn’t work.
a. And this to /etc/apache2/conf.d/perl.conf:
PerlRequire /etc/apache2/startup.pl
b. startup.pl
<br />
#!/usr/bin/perl<br />
use Apache2::compat;<br />
1;<br />
- To test. Paste the ff in test.asp under your webroot.
<!-- sample here --> For loop incrementing font size: <% for(1..5) { %> <!-- iterated html text --> <font size="<%=$_%>"> Size = <%=$_%> </font> <% } %> <!-- end sample here --> |