Saturday, September 13, 2008

Configuring Apache to run perl

Configuring Apache to run perl :

I have below RPM installed: (Default Fedora 9 Sulphur)
----------------------------------
httpd-2.2.8-3.i386
mod_perl-2.0.3-21.i386

In Fedora 9 perl specification :
===============================

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


*)
LoadModule perl_module modules/mod_perl.so

*)
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

test.pl
========
#!/usr/bin/perl
Content-type: text/html;
print 'mod_perl rock';
[root@linux perl]#

Point your browser ==> http//hostname/test.pl

Should show mod_perl rock!

No comments: