I am trying to configure apache2 running on ubunutu 12.04 to run perl script. But the script is not running when i submit the get request from the client. Below is the default config i have made (after reading in internet):
<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>
I have a perl script saved in the /home/Suresh/myFiles with chmod 777 permissions. Below is the perl code:
#!/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;
The perl works perfectly fine when run with perl command.
The script is not getting executed in default config file. Can anyone suggest me what else needs to be done ?