The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

mod_perl 2.0 Win32 Installation Instructions

Description

This document deals with installation specifics on Win32 platforms.

Synopsis

As described in the discussion of issues in multithreaded win32, a mod_perl 1.0 enabled server based on Apache 1.3 on Win32 is limited to a single thread serving a request at a time. This effectively prevents concurrent processing, which can have serious implications for busy sites. This problem is addressed in the multi-thread/multi-process approach of mod_perl 2.0/Apache 2.0, which consequently requires a Perl built with ithreads enabled.

There are some threading issues in perl-5.6 (upon which ActivePerl builds 6xx are based) which cause problems with mod_perl 2.0 on Win32. Consequently, the minimum required perl version is 5.8 (upon which ActivePerl builds 8xx are based) for use with mod_perl 2.0 on Win32.

Note that, at the present time, mod_perl 2 is in a development stage, with a version number 1.99_xx.

Installing

Unless you are using an all-in-one package, you should first install Perl and Apache, either from the sources or as binaries. The Perl sources are available from http://www.cpan.org/src/, with directions for building contained in README.win32. ActiveState also makes the sources available for their binary builds at ftp://ftp.activestate.com/ActivePerl/src/, which may contain, in particular, Win32-specific fixes not in the CPAN Perl sources. If you are building Perl from source then you must enable both USE_MULTI and USE_ITHREADS in the Makefile to enable ithreads, as required for mod_perl 2.0 on Win32. ActivePerl builds also enable USE_IMP_SYS, providing the implicit "host" layer which gives a fork() emulation, but this is at the cost of disabling PERL_MALLOC which may have significant performance implications since Win32's system malloc() is notably slower than Perl's in some situations. Thus, unless you require the fork() emulation or specifically want an ActivePerl- compatible build then you may want to disable USE_IMP_SYS and enable PERL_MALLOC. (Note that you cannot currently enable PERL_MALLOC with USE_IMP_SYS enabled as well.) As a binary, at present, an ActivePerl- compatible Perl, compiled with Visual C++, is the most common one used in the Win32 mod_perl/Apache environment; you can obtain such a prebuilt Perl binary from http://www.activestate.com/.

The Apache sources and binaries are available at http://httpd.apache.org/.

As of this writing, mod_perl 2.0 is known to compile and work with both an ActivePerl-compatible perl-5.8 (ActivePerl build 8xx) and with an otherwise similar Perl having USE_IMP_SYS disabled and PERL_MALLOC enabled. See the section on Apache/mod_perl binaries below for details on a suitable repository containing mod_perl ppm packages, and also how to obtain other Win32 binary packages.

When installing Perl or other related binaries, subtleties may arise in using path names that have spaces in them - you may, for example, have to specify C:\Program Files\ by the DOS 8.3 path name C:\Progra~1\ in certain Apache directives. If you want to avoid this, install, if possible, these packages to locations without spaces in their names (eg, C:\Perl for Perl and C:\Apache2 for Apache 2.0).

In the following, it may be necessary to invoke certain commands through a DOS prompt. A DOS window may be opened either through a Command Prompt option of the Start menu, or by choosing to run, from the Start menu, command or cmd, as appropriate.

Building from sources

If you are building mod_perl 2.0 from sources, it is probably also best to do the same for Apache 2.0. The Apache 2.0 sources can be obtained from http://httpd.apache.org/, which when unpacked will contain at the top-level a Visual Studio project file (make sure to obtain the win32-src.zip archive). Choose the InstallBin - Win32 Release target to build and install Apache 2.0, which by default will be placed in /Apache2. At the present time you must have version 2.0.47 or greater of Apache2 in order to build mod_perl.

Having built and installed Apache 2.0, next obtain the mod_perl 2.0 sources. First obtain the mod_perl 2.0 sources as a tar.gz file - when unpacked, using Winzip or similar tools, a subdirectory mod_perl-x.xx will be created. Next, run the command

    C:\modperl_src> perl Makefile.PL MP_AP_PREFIX=\Path\to\Apache2

Then

    C:\modperl_src> nmake
    C:\modperl_src> nmake test

will build and test mod_perl 2.0. mod_perl 2.0 on Win32 is considered at an alpha stage of development, so not all the tests may pass.

The final command,

    C:\modperl_src> nmake install

will install the necessary mod_perl 2.0 files into your Perl directory tree, and also copy src/modules/perl/mod_perl.so into your /Path/to/Apache2/modules/ directory.

If this build fails, or you want features not present in the official releases, you may want to try the sources obtained from cvs - see the discussion on the 2.0 Development Source Distribution for details. Be aware, though, that as well as providing bug fixes, there may be new features being added and tested in the cvs versions, so at any given time there are no guarantees that these packages will build and test successfully.

PPM Packages

The following assumes you already have ActivePerl 8xx (not 6xx) from http://www.activestate.com/ and a Win32 Apache 2.0 binary from http://httpd.apache.org/. In installing this, you might 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.

After installing Perl and Apache 2.0, you can then install mod_perl via the PPM utility. ActiveState does not maintain mod_perl in their ppm repository, so you must get it from a different location other than ActiveState's site. A quick way to do this is to download the script mpinstall and save it as, for example, mpinstall. Invoking this as perl mpinstall on a command line will take you through a dialogue, based on your configuration, which will determine and install, via ppm, the desired mod_perl ppm package.

The direct way to install mod_perl via ppm is simply as (broken over two lines for readability)

  C:\> ppm install
       http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd

Another way, which will be useful if you plan on installing additional Apache modules, is to set the repository within the ppm shell utility to

   http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58

using the repository add alias location for ppm3 (the default with ActivePerl 8xx), and using set repository alias location for ppm2; see the help utility within the ppm shell for details. mod_perl 2.0 can then be installed as install mod_perl within the ppm shell, which will install the necessary modules under an Apache2 subdirectory in your Perl tree, so as not to disturb a possible existing Apache directory from mod_perl 1.0. See the section below on configuring mod_perl to add this directory to the @INC path for searching for modules.

The mod_perl PPM package also includes the necessary Apache DLL mod_perl.so; a post-installation script should be run which will offer to copy this file to your Apache2 modules directory (eg, C:/Apache2/modules/). If this fails, you can get mod_perl.so from http://theoryx5.uwinnipeg.ca/ppms/x86/ and install it to your Apache2 modules directory by hand.

Note that, because of binary incompatibilities, one should not install packages for ActivePerl 8xx from a repository containing packages for ActivePerl 6xx, and vice-versa, particularly if these packages contain XS-based modules.

The mod_perl package available from this site will always use the latest mod_perl sources available from CPAN compiled against the latest official Apache release; depending on changes made in Apache, you may or may not be able to use an earlier Apache binary. However, in the Apache Win32 world it is particularly a good idea to use the latest version, for bug and security fixes. If you want to try a later development version of mod_perl 2, get the mod_perl-dev.ppd ppm package instead; the development version may contain bug fixes that were found since the last CPAN release, but it may also contain experimental features that have not been fully tested.

If you encounter problems loading mod_perl.so, ensure that the mod_perl version you are using matches that of Apache, make sure you are using at least Apache/2.0.47, and also make certain Perl is in your PATH environment variable or try adding the Apache directive

  LoadFile "C:/Path/to/your/Perl/bin/perlxx.dll"

before loading mod_perl.so. If all else fails, a reboot may help.

If the theoryx5.uwinnipeg.ca repository is down, you can access these packages at http://www.apache.org/dyn/closer.cgi/perl/win32-bin/ppms/, for builds 8xx, and http://www.apache.org/dyn/closer.cgi/perl/win32-bin/ppmpackages/, for builds 6xx.

All in one packages

There are a number of binary packages for Win32 that contain the necessary Perl and Apache binaries:

As well, at http://www.apache.org/dyn/closer.cgi/perl/win32-bin/ there is a package Perl-5.8-win32-bin.exe containing a binary version of perl-5.8 (compatible with ActivePerl 8xx), together with Apache 2.0 and mod_perl 2.0. See the file Perl-5.8-win32-bin.readme for a description. If you have trouble fetching the whole file at once, the directory http://www.apache.org/dyn/closer.cgi/perl/win32-bin/Perl-5.8-win32-bin/ contains this distribution split across multiple files - see README.join for instructions on how to join them. Alternatively, if you have Perl already, you can get the script distinstall which, when invoked as perl distinstall, will fetch and join the files for you.

See Also

The directions for configuring mod_perl 2.0 on Win32, the mod_perl documentation, http://httpd.apache.org/, http://www.activestate.com/, and the FAQs for mod_perl on Win32. Help is also available through the archives of and subscribing to the mod_perl mailing list.

Maintainers

Maintainer is the person(s) you should contact with updates, corrections and patches.

  • Randy Kobes <randy@theoryx5.uwinnipeg.ca>

Authors

  • Randy Kobes <randy@theoryx5.uwinnipeg.ca>

Only the major authors are listed above. For contributors see the Changes file.