Apache, PHP, MySQL, ASP.NET, JSP and Perl Solutions for your Web Development and Hosting Needs on Windows.
A Complete Web Development and Hosting Platform for Windows.

Building mod_perl 2.0.2

Building a Web Server, for Windows

Requirements

  • Microsoft Visual C++
    [we will use Visual Studio 98 / VC++ 6.0]
    [Visual Studio .NET will also work with the same instructions]
  • Perl 5.8.0+
  • Apache 2.0.47+
  • Notes:
    • When using the command-line (command-shell) with VC++, always set the Build Environment and update the System PATH to reflect the tools used in the build --> Guide: Working with the Command Shell

Download

Our Configuration

  • Install to : C:\www\perl
    [do not install to a directory that contains white spaces]
  • Apache path : C:\www\Apache2

Build/Install Required Perl-Modules

A group of Perl modules need to be built and installed prior to the main mod_perl build process. This step can be skipped by installing Bundle::Apache2. Note that this is needed for the 'nmake test' process -- these modules are not required to build mod_perl, just to test that build.

  • Download and unpack the following modules...
  • In the order above, from the source directory of each module, build and install each module...
    [read file README in each module dir for the official instructions]
    • ...\module> perl Makefile.PL
      [create 'Makefile']
    • ...\module> nmake
      [build module]
    • ...\module> nmake test
      [test built module; this step is optional]
      [note that several tests could fail; continue]
    • ...\module> nmake install
      [install module]

Build/Install mod_perl

  • cd /d C:\build\mod_perl-2.0.2
  • > perl Makefile.PL MP_AP_PREFIX=C:\www\Apache2
    [select 'no' for apxs]
  • > nmake
  • > nmake test
    [this step is optional, and could be time consuming]
    [for this step, use httpd.default.conf (the original and unmodified httpd.conf) for Apache2\conf\httpd.conf]
    [note that several tests could fail with an illegal memory reference; click 'ok' each time, continue]
  • > nmake install

Apache Setup for mod_perl

  • Edit file C:\www\Apache2\conf\httpd.conf
    • Add LoadModule perl_module modules/mod_perl.so

Testing mod_perl

This will create an example perl module, Hello.pm

  • Edit file C:\www\Apache2\conf\httpd.conf

    PerlModule Apache2::Hello
    <Location /hello>
       SetHandler modperl
       PerlResponseHandler Apache2::Hello
    </Location>

  • Create file C:\www\perl\site\lib\Apache2\Hello.pm

    package Apache2::Hello;
    use strict;
    use Apache2::RequestRec (); # for $r->content_type
    use Apache2::RequestIO (); # for $r->puts
    use Apache2::Const -compile => ':common';
    sub handler {
      my $r = shift;
      my $time = scalar localtime();
      my $package = __PACKAGE__;
      $r->content_type('text/html');
      $r->puts(<<"END");
      <HTML><BODY>
      <H3>Hello</H3>
      Hello from <B>$package</B>! The time is $time.
      </BODY></HTML>
      END
      return Apache2::Const::OK;
    }
    1;

  • Restart Apache and access http://localhost/hello

Help

In the Spotlight

In the Spotlight

Developing and Hosting PHP+MySQL based websites and applications has never been simpler. The Web.Developer Server Suite provides a Platform & Framework on which to create standards-based CSS, XSLT, and XHTML sites running on PHP and MySQL. Save your time, focusing on core business. Reduce complexity and maximize your productivity.

Developers

Developers++

The Web.Developer Server Suite is more than just a Windows based Apache|PHP|MySQL Platform. Suitable for novices and professionals alike, a complete Hosting Solution is provided that is capable of creating and deploying websites and web applications both locally and on the internet. Create, test, publish and maintain your websites in-house, on your own server, where you are in full control.

Newsletter Signup

Newsletter Signup

Enter your e-mail address: