Page 1 of 1

Perl on Centos 5

Posted: 2012/10/24 12:57:13
by daleangusbain

I am a total noob with CentOS

I have manages to get Apache, PHP and well I though Perl

But when I go to a page that has been written in Perl all I see is the Perl code

use strict;
use BSD::Resource;
setrlimit(RLIMIT_AS, 128000000, 1280000000);
setrlimit(RLIMIT_CPU, 120, 120);
use CGI;
use Cwd 'getcwd';
use IO::Handle;
my $cwd=getcwd();
my $root_path;
if($cwd=~m#^(/home/(?:sites|cluster-sites/\d+)/[\w\.\-]+/)#) {
} else {

$0 = "awstats";

my $cgi=new CGI;
%ENV=(PATH=>'/bin:/usr/bin:/usr/local/bin', HTTP_HOST=>$ENV{HTTP_HOST});


print $cgi->header("text/html");
print "<html><head><title>AWStats</title></head><body>";
print "<p>Generating stats for the first time. Please wait, this can take a while.</p><p>";

my $pid=fork();
die unless defined $pid;

if(!$pid) {
# child
open(STDOUT, ">&STDERR");
exec("./","", "-update");
exit 1;
use POSIX ":sys_wait_h";
my $i = 0;
while(waitpid(-1, WNOHANG) <= 0) {
print ".";
if($i % 100 == 0) {
print "<br/>\n";
sleep 1;
print "</p><p>Complete. You will be redirected to <a href=''>the stats page</a> in a moment.</p>";
print "<script type='text/javascript'>function onward() {location.href=''} setTimeout(onward, 3000)</script>";
print "</body></html>";
All of the installs that I have done are strait out of the box, and I haven’t changed anything

Any help?

Perl on Centos 5

Posted: 2012/10/24 14:48:28
by TrevorH
`yum install mod_perl` perhaps? Followed by a `service httpd restart`

Re: Perl on Centos 5

Posted: 2012/10/25 07:15:06
by daleangusbain
I tried that yesterday

Installed mod_perl and restarted the service still the same

Re: Perl on Centos 5

Posted: 2015/02/25 06:36:31
by yarnik
Cmod 755 ?

Re: Perl on Centos 5

Posted: 2015/02/25 08:55:28
by TrevorH
What is your file called that you are serving? Where is it located?