Perl+Apache=Love

Sep 6, 2007 13:59 GMT  ·  By

If you want to use Perl in Apache, the best solution is to install Perl module for Apache: mod_perl. Why do you need to install mod_perl? Because under mod_perl the existing CGI scripts will run faster. Also, converting existing CGI scripts to run under mod_perl is very easy. Also, content handlers can be written in a few lines of code and can be quickly integrated with existing modules.

Third party modules will give you access to functionality as passwords, sessions and database integration.

To install mod_perl for Apache 2.0, the minimum required perl version is 5.8. Download the latest version of mod_perl2 and extract the file from .tar.gz archive.

Next, run the command: C:modperl_src> perl Makefile.PL MP_AP_PREFIX=Path oApache2.

Then use the following commands to build and test mod_perl2:

C:modperl_src> nmake C:modperl_src> nmake test

To install the necessary mod_perl 2.0 files into your Perl directory tree use the command: C:modperl_src> nmake install

and copy src/modules/perl/mod_perl.so into your /Path/to/Apache2/modules/ directory. This installation is recommended if you want to build mod_perl2 and Apache from sources.

If not, use PPM packages to avoid some future problems by choosing installation directories that do not have spaces in their names (eg, C:/Apache2). At this time you must have version 2.0.47 or greater of Apache2 in order to install the mod_perl 2 ppm package. Download and install ActivePerl and Apache and after that you may install mod_perl via the PPM utility. Download and save the mpinstall script as it is, mpinstall. Run it using perl mpinstall and you will have to configure the mod_perl module. You will choose your Apache2 installation directory and it will download automatically the version of mod_perl for your Apache2 server. Using this method you will have the instructions on your screen and you can`t fail.