Saturday, September 13, 2008

Configuring Apache to run perl

Configuring Apache to run perl :

I have below RPM installed: (Default Fedora 9 Sulphur)

In Fedora 9 perl specification :

$cat /etc/httpd/conf.d/perl.conf

LoadModule perl_module modules/

Alias /perl /var/www/perl

< Directory /var/www/perl >
SetHandler perl-script
AddHandler cgi-script .cgi .pl
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
< /Directory >

< Location /perl-status >
SetHandler perl-script
PerlResponseHandler Apache2::Status
Order deny,allow
#Deny from all
Allow from all
< /Location >

in my /etc/httpd/conf/httpd.conf i have below line
Include conf.d/*.conf

Now put your perl script in /var/www/perl
Content-type: text/html;
print 'mod_perl rock';
[root@linux perl]#

Point your browser ==> http//hostname/

Should show mod_perl rock!