Linux下Apache mod_per配置ASP服务器

具体的安装如下;
1.安装redhat linux 9.0
以最小化安装,完成后从光盘启动,定制安装gcc,因之后编译原代码需要它,而以最小化安装时并没有默认的把它安装进去。
cp apache,perl,mod_perl到/usr/local/src
2.安装Apache-2.2.0
#tar xzvf httpd-2.2.0.tar.gz
#cd httpd-2.2.0
#./configure --prefix=/usr/local/apache --enable-so --enable-auth-anon --enable-auth-dbm --enable-expires --enable-proxy --enable-rewrite --enable-autoindex
(安装过程和网上“南非蜘蛛”所述有点不一样,因在apache2.x下,用他的方法不能将这些模块加进去,且也不会报错~!./configure --help查看之后采用这种方法,终于在./httpd -l下有了这些模块)
#make
#make install
3.安装perl-5.8.8
因redhat 9.0默认已经安装perl-5.8.0,我先删除之,因如果继续采用他的版本的话,在后面install CPAN会报错,说找不到CPAN.pm什么的,具体我也忘了~!
#rpm -e perl --nodeps
#tar xzvf stable.tar.gz //perl-5.8.8 版本
#cd perl-5.8.8
#sh Configure -de
#make
#make test
这会出现:make:[extras.make]error 1 (ignored)在网上查了,好象是正常的样子:this is normal且最后test ok
#make install

在这种安装情况下并没有安装为ithreade模式,而在后面安装mod_perl运行make test的时候会检测出,并skip。要手动安装便去掉-de参数,在选择是否采用ithreade的时候选y。

perl ok后:

#perl -MCPAN -eshell
cpan>install MCPAN
cpan>install HTTP::Date
4.安装mod_perl-2.0.2
#tar xzvf mod_perl-2.0.2.tar.gz
#cd mod_perl-2.0.2
#perl Makefile.PL MP_APXS=/usr/local/apache/bin/apxs DO_HTTPD=1 USE_DSO=1 EVERYTHING=1 USE_APACHI=1 MP_APXS=/usr/local/apache/bin/apxs
如果使用DSO安装会报错(网上也有人说他没有报错,但我装了几次,试图用DSO都没有成功,最后一次我也忘了是否成功)
#make
#make test
如果在这之前不运行cpan>install HTTP::Date,一些模块不能找到,例如:HTML::HeadParser,URI……没安装libwww…….但最后显示:all tests successfull 10 tests skipped
#make install
4.安装Apache::ASP
#cpan
cpan>install MLDBM
cpan>install MLDBM::Sync
cpan>install Apache::ASP
没有安装另外的那个模块,在Apache::ASP的网站上说他对于perl-5.8.0以上的版本可以不安装。
5.配置httpd.conf
在配置文件的最后加上了如下几条:
LoadModule perl_module modules/mod_perl.so
PerlModule Apache::ASP
<File ~(/.asp)>
 SetHandler perl-script
 PerlHandler Apache::ASP
 PerlSetVar Global .
 PerlSetVar StateDir /tmp/asp
</Files>
重启服务器之后在/usr/local/apache/htdocs目录下放置了个ASP程序,
在浏览器中却显示原代码,
而我把上面的<File ~(/.asp)>改为<File *.asp>之后在浏览器中却出现如下提示:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
--------------------------------------------------------------------------------
Apache/2.2.0(unix) mod_perl/2.0.2 Perl/v5.8.8 Server at 192.168.0.213 Port 80

这是500号错误,

在服务器的log里又有类似如下消息(这是使用他的例子的时候的日志);
[Tue Apr 18 17:12:34 2006] [error] [client 192.168.0.124] Can't locate object method "get" via package "APR::Table" at /usr/local/lib/perl5/site_perl/5.8.8/Apache/ASP.pm line 2016./n at /usr/local/lib/perl5/site_perl/5.8.8/Apache/ASP.pm line 2016/n/tApache::ASP::get_dir_config('APR::Table=HASH(0x82015b4)', 'Global') called at /usr/local/lib/perl5/site_perl/5.8.8/Apache/ASP.pm line 275/n/tApache::ASP::new('Apache::ASP', 'Apache2::RequestRec=SCALAR(0x82015f0)', '/usr/local/apache/htdocs/asp/eg/source.asp') called at /usr/local/lib/perl5/site_perl/5.8.8/Apache/ASP.pm line 183/n/tApache::ASP::handler('Apache2::RequestRec=SCALAR(0x82015f0)') called at -e line 0/n/teval {...} called at -e line 0/n, referer: http://192.168.0.213/asp/eg/

这需要在他的配置文件(http.conf)里再加一条:
PerlModule Apache2::compat
这样还不行,你运行Windows下的ASP程序还是会报错,因在Linux下,ASP的语法格式已经稍有了变化~!注意看他的测试程序代码:
#session.asp
<%
    my $form = $Request->Form();
# process form here
if($form->{increment}) {
    $Session->{Count}++;
} elsif($form->{timeout}) {
    $Session->Timeout(.25);
} elsif($form->{abandon}) {
    $Session->Abandon();
}
my @rows = (
  '$Session->{Count}',
  '$Session->{Timeout}',
  '$Session->{SessionID}'
  );
%>
<!--#include file=header.inc-->
This file demonstrates the use of the $Session object, as well
as one implementantion of cookieless sessions involving the
use of the SessionQuery setting, and the <nobr>$Server->URL($url, /%params)</nobr>
method to add session ids to the form query string.
<p>
To demo the cookieless sessions, just turn off your cookies
and use this form.
<p>
<center>
<table border=1>
<tr><td colspan=2 align=center><b>Session Object Demonstration</b></td></tr>
<form action=<%=$Server->URL($demo->{file})%> method=POST>
<tr>
 <td colspan=2 align=center>
 <input type=submit name=increment value="Increment Count">
 <input type=submit name=timeout   value="Timeout 15 Seconds">
 <input type=submit name=abandon   value="Abandon">
 <td>
</tr>
</form>
<% for (@rows){ %>
 <tr>
  <td><tt><%=$Server->HTMLEncode($_)%></tt></td>  
  <td><%=eval($_) || $@%></td>
 </tr>
<% } %>
</table>
</center>
<p>
The value for $Session->{Count} gets reset to 10 on every session start
in the global.asa file.
<!--#include file=footer.inc-->

 

总结:在linux下运行ASP服务器是个错误。 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值