Install mod perl as DSO module

There are different ways to install mod_perl. This article explains how to install it as DSO using Apache extension tool apxs.

1) Download and untar the source.

$ cd /usr/local/src
$ wget http://perl.apache.org/dist/mod_perl-1.0-current.tar.gz
$ tar -xzf mod_perl-1.0-current.tar.gz
$ cd mod_perl-1.29/

2) Configure it as DSO

$ perl Makefile.PL USE_APXS=1 WITH_APXS=/usr/local/apache/bin/apxs EVERYTHING=1
$ make
$ make test
$ make install

3) Restart httpd

$ /usr/local/apache/bin/apachectl configtest
$ /usr/local/apache/bin/apachectl restart

You may use the above procedure for installing mod_perl as DSO module in Cpanel server running Apache 1.3.x. You may test the mod perl installed by adding the following configuration directives in httpd.conf.

# mod_perl scripts will be called from
Alias /perl /home/<user>/public_html/perl
PerlModule Apache::Registry

<Location /perl>
AllowOverride All
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
PerlSendHeader On
Allow from all
Options +FollowSymLinks
</Location>

You may put the above entry anywhere in httpd.conf.  And, here are two sample files for testing.

test1.pl

 use strict;
my $r = shift;
$r->send_http_header(‘text/html’);
$r->print(“It worked!!!\n”);

test2.pl

my $r = Apache->request;
$r->send_http_header(‘text/plain’);
$r->print(“mod_perl rules!\n”);


Those files must have 755 permission.

Both comments and pings are currently closed.

Comments are closed.