Hi,

I'm just starting out with mod_perl and am using the book "MySQL and
Perl for the Web" by Paul DuBois for guiding me through some of the
intricacies.

The book is a bit old (2002) and was written for mod_perl v1 and I've
a few questions about the differences between that and the current
version.

In the book its advised that part of httpd.conf should be as follows
(obviously paths are dependent on config, and in particular I've noted
that on my gentoo system mod_perl is configured at
/etc/apache/modules.d/75_mod_perl_conf)...

Alias /cgi-perl /usr/local/apache/chi-perl/
<Location /cgi-perl>
   SetHandler perl-script
   PerlHandler Apache::Registry
   PerlSendHeader on
   Options ExecCGI
</Location>
<Location /perl-status>
   SetHandler perl-script
   PerlHandler Apache::Registry
   order deny, allow
   deny from all
   allow from 127.0.0.1
</Location>

It includes a short CGI script (below) that when run reports various
environment variables, and indicates that the GATEWAY_INTERFACE should
be CGI-perl/1.1

#!/usr/bin/perl -w
##
## Place in your cgi-bin folder
print "Content-Type: text/html\n\n";
print "<html><head><title></title></head><body>\n";
print map { " $_ = $ENV{$_}<br>\n" } sort (keys (%ENV));
print "</body></html>\n";

My current configuration for mod_perl looks like the following...

<IfDefine PERL>
  <IfModule !mod_perl.c>
    LoadModule perl_module    modules/mod_perl.so
  </IfModule>
</IfDefine>

<IfModule mod_perl.c>
        #PerlTrace all
        PerlRequire "/etc/apache2/modules.d/apache2-mod_perl-startup.pl"

        #Provide two aliases to the same cgi-bin directory,
        #to see the effects of the 2 different mod_perl modes
        #for Apache2::Registry Mode
        Alias /perl/ /var/www/localhost/perl/
        #for Apache2::Perlrun Mode
        Alias /cgi-perl/ /var/www/localhost/perl/

#       <IfModule mod_access.c>
        <Location /perl-status>
                SetHandler perl-script
                PerlResponseHandler Apache2::Status
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
        </Location>
#       </IfModule>

    <Directory /home/*/public_html/perl>
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        Options -Indexes ExecCGI
                PerlOptions +ParseHeaders
    </Directory>

    PerlModule ModPerl::Registry
    #set Apache::Registry Mode for /perl Alias
    # To set subdirectories to use perl set the following
    # and comment the orignial:
    # <Location ~ "^/perl/.*\.pl$">
    <Location  "^/perl/*.pl>
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>

    #set Apache::PerlRun Mode for /cgi-perl Alias
    <Location /cgi-perl/*.pl>
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>

</ifModule>

...and when I run the script I get GATEWAY_INTERFACE = CGI/1.1

So, finally on to my questions.

1. Is PerlResponseHandler under mod_perl 2.0 the equivalent of
PerlHandler under mod_perl 1.1?

I found details of renames from v1.1 to 2.0 at
http://perl.apache.org/docs/2.0/rename.html but couldn't see any
mention of this, and searching the archives didn't throw up anything.

2. Should I be worried about the GATEWAY_INTERFACE = CGI/1.1 ? What is
the specific implication of having it as this, compared to
CGI-perl/1.1 ?  What module should I be setting
(PerlResponseHandler???) to  get this variable to in order to get
CGI-perl?

I've tried modifying the PerlResponseHandler to the only Registry.pm
that I have installed on my system (which is ModPerl::Registry,
located at /usr/lib/perl5/vendor_perl/5.8.8/i686-linux/ModPerl/Registry.pm)
but this doesn't make any difference.

3. The book indicates that one of the Environment variables that
should be reported by the script is MOD_PERL, but I don't see this,
despite mod_perl being included and configured when apache is started
as shown in the logs after restarting ([Tue Nov 20 16:49:56 2007]
[notice] Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g
mod_perl/2.0.3-dev Perl/v5.8.8 configured -- resuming normal
operations).  Have I done something wrong, and/or why is the MOD_PERL
environment variable missing?

I realise that the most likely problem stems from using an out-of-date
book, but it was the only one I could find that covered Perl and MySQL
for the web, and despite searching the archives and so forth I'm still
none the wiser as to what sort of configuration I should be aiming for
(well thats not strictly true as I do want to use mod_perl to handle
all CGI in as efficient a manner as possible and thats why I'm trying
to go through this configuration, but I'm finding it tricky to adapt
the instructions for mod_perl 1* and the current version).

If you've got this far, my thanks for taking the time to read and I
appreciate any and all input.

Cheers,

Neil


-- 
"Don't remember what you can infer." - Harry Tennant

Email - [EMAIL PROTECTED] / [EMAIL PROTECTED]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/

Reply via email to