我正在尝试配置在 ubunutu 12.04 上运行的 apache2 以运行 perl 脚本。但是当我从客户端提交获取请求时,脚本没有运行。以下是我所做的默认配置(在互联网上阅读后):
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/Suresh/myFiles
<Directory /home/Suresh/myFiles>
Options Indexes FollowSymLinks MultiViews +ExecCGI
AddHandler cgi-script .pl
AllowOverride ALL
Order allow,deny
allow from all
ExpiresActive On
ExpiresDefault "access plus 6 hours"
<FilesMatch "\.(nff)">
Header set Cache-control "max-age=0, no-cache, proxy-revalidate"
Header set Content-Type "application/octet-stream"
Header set Pragma "no-cache"
Header unset Vary
Header set Connection "Keep-Alive"
</FilesMatch>
</Directory>
我有一个 perl 脚本保存在 /home/Suresh/myFiles 中,具有 chmod 777 权限。下面是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;
当使用 perl 命令运行时,perl 工作得非常好。
该脚本未在默认配置文件中执行。谁能建议我还需要做什么?