Installing mod_perl on a local Windows-based, Apache server

The home page of mod_perl gives a great explanation of what mod_perl is, and what it provides. We'll be installing mod_perl simply because it will help us install other functionality as time goes by.

Download mod_perl

The home of mod_perl is located at http://perl.apache.org/. Select Download > Binary mod_perl distributions, and find Win32 Active Perl > Win32 mod_perl 1.0 ppm packages. This will lead you to http://theoryx5.uwinnipeg.ca/ppms/x86/, where you can download mod_perl-1.so Save to c:\home\downloads.

Installing mod_perl

First place a copy of the mod_perl-1.so file into C:\Program Files\Apache Group\Apache\modules\, and change it's filename to mod_perl.so.

Next, open httpd.conf, and search for mod_foo.so.

At the end of the LoadModule calls, add the following:

LoadFile "c:/usr/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so

Now scroll down a bit and add to the end of the AddModule calls the following:

AddModule mod_perl.c

If you installed ActivePerl to a location other than c:\usr\, then your dll file may be in a different location. Also, if you installed a different version, you'll need to verify the perl dll version. It should be in the format of perlxx.dll.

Search for .cgi, and add .pl to the end of this line. You'll end up with the following.

AddHandler cgi-script .cgi .pl

Finally, save httpd.conf and restart Apache.

Testing the install of mod_perl

Now, create a document with the following text:

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "mod_perl rules!\n";

Save this as mod_perl_test.pl, in your Web root folder (c:\home\ if you've been following along). Now load http://localhost/mod_perl_test.pl Once you do, you should simply see "mod_perl rules!".

Additionally, load up http://localhost/phpinfo.php and scroll down to the apache heading. You should see, in the Apache Version, mod_perl/1.29_01-dev (or something similar to this, depending upon what version you installed).

You've now successfully installed mod_perl.

View all of the steps to creating a local Web server, for development.