httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Gaddy" <>
Subject Apache 2.0.35 for Win2kPro - CGI/PHP/Perl Issue
Date Mon, 03 Jun 2002 13:31:29 GMT
I would first off like to say that PHP does work with apache 2.0.35, as I figured it all out
yesterday and have it running great...  Secondly, thank you VERY much for that Perl link...
I have installed perl via ppm, configured httpd.conf for perl, stopped and started apache,
and now at the bottom of my apache service monitor it shows:

Apache/2.0.35 (Win32) mod_perl/1.99_02-dev Perl/v5.6.1

The fact that it started with no issues is very good to me... I do believe that the above
line is a good one to see, and I believe perl to be completely configured on my machine...
I did not however use the last bit of the perl link that stated:

Registry scripts
Using Apache::Registry to speed up cgi scripts may be done as follows. Create a directory,
for example, C:\Apache\mod_perl, which will hold your scripts. Insert then in C:\Apache\conf\httpd.conf
the following directives:

  Alias /mod_perl/ "/Apache/mod_perl/"
  <Location /mod_perl>
     SetHandler perl-script
     PerlHandler Apache::Registry
     Options +ExecCGI
     PerlSendHeader On
whereby the script would be called as



Hello World
As you will discover, there is much to mod_perl beyond simple speed-up of cgi scripts. Here
is a simple Hello, World example that illustrates the use of mod_perl as a content handler.
Create a file as follows:

  package Apache::Hello;
  use strict;
  use Apache::Constants qw(OK);
  sub handler {
     my $r = shift;
     $r->print("<html><body>Hello World!</body></html>\n");
     return OK;
and save it in, for example, the C:\Perl\site\lib\Apache\ directory. Next put the following
directives in C:\Apache\conf\httpd.conf:

  PerlModule Apache::Hello
  <Location /hello>
     SetHandler perl-script
     PerlHandler Apache::Hello
With this, calls to

will use Apache::Hello to deliver the content.

Is it ok first off that I did not do this, because it all seemed optional...  Another reason
I didnt do it is because it didnt seem like the right syntax, as the "alias" directive in
apache should have the path in quotation marks end WITHOUT a trailing forward slash... I didnt
know if the mistake was that the directive to use should have been "scriptalias" or if the
trailing forward slash needed to be removed... Nonetheless, my main question is DO I NEED
TO DO THE ABOVE STEPS THAT WERE NOT DONE... What I need to know is, using just the standard
setup of mod_perl and active perl 5.6.1 using these install directions:

For users of ActivePerl, available from
there are also PPM mod_perl packages available. For this, if you don't already have it, get
and install the latest Win32 Apache binary from
Both ActivePerl and Apache binaries are available as MSI files for use by the Microsoft Installer
- as discussed on the ActiveState site, users of Windows 95 and 98 may need to obtain this.
In installing these packages, you may find it convenient when transcribing any Unix-oriented
documentation to choose installation directories that do not have spaces in their names (eg,
C:\Perl and C:\Apache).

After installing Perl and Apache, you can then install mod_perl via the PPM utility. ActiveState
does not maintain mod_perl in the ppm repository, so you must get it from a different location
other than ActiveState's site. One way is simply as (broken over two lines for readability)

  C:\> ppm install
Another way, which will be useful if you plan on installing additional Apache modules, is
to set the repository within the ppm shell utility as (the set repository ... command has
been broken over two lines for readability):

   C:\> ppm
   PPM> set repository theoryx5 
   PPM> install mod_perl
   PPM> set save
   PPM> quit
The set save command saves the theoryx5 repository to your PPM configuration file, so that
future PPM sessions will search this repository, as well as ActiveState's, for requested packages.

The mod_perl PPM package also includes the necessary Apache DLL; a post-installation
script should be run which will offer to copy this file to your Apache modules directory (eg,

Note that the mod_perl package available from this site will always use the latest mod_perl
sources 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

Add this line to C:\Apache\conf\httpd.conf:

 LoadModule perl_module modules/
Be sure that the path to your Perl binary (eg, C:\Perl\bin) is in your PATH environment variable.
If you have a ClearModuleList directive enabled in httpd.conf, you may also need to add

 AddModule mod_perl.c
See the descriptions of the ClearModuleList and AddModule directives in the Apache documents
for more details, especially concerning the relative order of these and the LoadModule directive.

If the above directions is all I used, and with my "documentroot" being "c:\webserver\webs",
(which beneath webs are several folders that are webpages that have my virtualhosts are using),
would I be able to add a perl script under "c:\webserver\webs\domain\" so that when I type
in it will activate the script, (this of course is assuming a lot,
one of the things being that I have proper DNS - which I do, and also that my virtual host
section points back an IP for the domain folder - which it does)... This is what I need to
know and if you could please help me on this, I would very much so appreciate it...

Thanks again,

Daniel Gaddy

  ----- Original Message ----- 
  From: Chris Hsiang 
  Sent: Friday, May 31, 2002 11:39 AM
  Subject: RE: Apache 2.0.35 for Win2kPro - CGI/PHP/Perl Issue

  First, I doubt if PHP works with Apache 2.0.35 and also I never play with PHP at all.


  For Perl, it should be easy.  I use active Perl 5.6.1 and it works great Follow the instruction
of this link you should able to get your modperl working. You should only need to install
PPM packages and that's it.


  Remember that in your perl script to put the full path to the perl.exe like this.



  You don't need to add a handler for perl


  For CGI, in your httpd.conf


  AddHandler cgi-script .cgi


  ScriptAlias /cgi-bin/ "F:\Apache\Apache2\cgi-bin/"       #look at the path must be [Drive]:\..\..\../


  <Directory "F:\Apache\Apache2\cgi-bin">

      AllowOverride None

      Options +ExecCGI

      Order allow,deny

      Allow from all


  Chris Hsiang
  Intervivos LLC


View raw message