httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Gaddy" <dga...@sparctech.com>
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
  </Location>
whereby the script would be called as

   http://localhost/mod_perl/name_of_script


 


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 Hello.pm as follows:

  package Apache::Hello;
  use strict;
  use Apache::Constants qw(OK);
  
  sub handler {
     my $r = shift;
     $r->send_http_header;
     $r->print("<html><body>Hello World!</body></html>\n");
     return OK;
   }
  
  1;
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
  </Location>
With this, calls to

   http://localhost/hello
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

   http://www.activestate.com/
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

   http://httpd.apache.org/
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
       http://theoryx5.uwinnipeg.ca/ppmpackages/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 as (the set repository ... command has
been broken over two lines for readability):

   C:\> ppm
   PPM> set repository theoryx5 
         http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer
   PPM> install mod_perl
   PPM> set save
   PPM> quit
   C:\>
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 mod_perl.so; a post-installation
script should be run which will offer to copy this file to your Apache modules directory (eg,
C:\Apache\modules).

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
fixes.

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

 LoadModule perl_module modules/mod_perl.so
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 www.domain.com/PERLSCRIPT 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 
  To: users@httpd.apache.org 
  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.

   

  http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/win32/binaries.html#PPM_Packages

   

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

  #!E:/Perl/bin/perl.exe

   

  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

  </Directory>

  Chris Hsiang
  Intervivos LLC

   


Mime
View raw message