ubuntu中的Mod Perl
我正试图将运行在ubunutu 12.04上的apache2配置为运行perl脚本。但是当我从客户端提交get请求时,脚本没有运行。 以下是我所做的默认配置(在互联网上阅读后): 当使用perl命令运行时,perl工作得非常好 未在默认配置文件中执行脚本。ubuntu中的Mod Perl,perl,ubuntu,apache2,mod-perl2,Perl,Ubuntu,Apache2,Mod Perl2,我正试图将运行在ubunutu 12.04上的apache2配置为运行perl脚本。但是当我从客户端提交get请求时,脚本没有运行。 以下是我所做的默认配置(在互联网上阅读后): 当使用perl命令运行时,perl工作得非常好 未在默认配置文件中执行脚本。 有人能告诉我还有什么需要做的吗 您应该使用此配置: <VirtualHost *:80> Alias /perl/ /home/Suresh/myFiles <Location /perl/>
有人能告诉我还有什么需要做的吗 您应该使用此配置:
<VirtualHost *:80>
Alias /perl/ /home/Suresh/myFiles
<Location /perl/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Order allow,deny
Allow from all
</Location>
</VirtualHost>
别名/perl//home/Suresh/myFiles
SetHandler perl脚本
PerlResponseHandler ModPerl::注册表
peroptions+ParseHeaders
选项+执行CGI
命令允许,拒绝
通融
然后必须使脚本可执行%chmod a+rx/home/Suresh/myFiles/script.pl
重新启动apacher服务器并转到http://localhost/perl/script.pl
就这些
另外,您可以在那里找到更多信息错误日志中有什么?错误日志中没有任何错误。请求的文件已送达,但未执行perl脚本。此处您没有使用mod_perl。这只是普通的CGI。你能建议我如何使用mod_perl吗?
#!/usr/bin/perl
use strict;
use CGI;
#require LWP::UserAgent;
my $q = new CGI;
my @rawCookies = split /~/, $ENV{'HTTP_COOKIE'};
my $extfile = '/home/suresh/Cookies.txt';
open(FH, ">>$extfile") or die "Cannot open file";
print FH "STB Cookies: ", $ENV{'HTTP_COOKIE'}, "\n";
close FH;
<VirtualHost *:80>
Alias /perl/ /home/Suresh/myFiles
<Location /perl/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Order allow,deny
Allow from all
</Location>
</VirtualHost>