kabeldag has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys n Gals,

I enabled suExec when I built httpd 2.2.2. Then I built in DSO mod_perl 2.0.2.

Why does GATEWAY_INTERFACE return CGI/1.1 from %ENV when the location directive
that is being served has the "SetHandler perl-script" entry in it ?

Shouldn't httpd return a different value in GATEWAY_INTERFACE depending on what code set is
being used to handle the request ? How does GATEWAY_INTERFACE get set anyway ?

Also, I seem to not be able to load Apache::Registry and other modules as they cannot be found in
@INC (@INC actually contains most module paths). Though I can't even see Apache::Registry within
the mod_perl 2.0.2 source tree which would probably explain why it never got installed that way.
Maybe I need to get it myself, or not even worry about it as ModPerl::Registry is for the same purpose,
and it is in the mod_perl 2.0.2 module source tree and was installed and can be used fine.

How can I be sure that mod_perl is being called by httpd to execute what I want it to ?

Here is the httpd.conf and vhosts.conf container configurations as well as error_log startup logs
and /perl-status output etc:

httpd.conf relative entries:
# Can load from vhosts container, but hey. LoadModule perl_module modules/mod_perl.so Include conf/extra/httpd-vhosts.conf
Contents of the VirtualHost container:
<VirtualHost something:80> PerlSetupEnv On ServerAdmin something #SuexecUserGroup something something DocumentRoot "/something/www/" ServerName something ServerSignature Off ErrorLog logs/something.error.log CustomLog logs/something.access.log common <Directory "/something/www/"> Order allow,deny Allow from all AllowOverride None Options Indexes FollowSymLinks </Directory> ScriptAlias /cgi-bin/ "/something/cgi-bin/" #Alias /cgi-bin/ /something/cgi-bin/ Alias /perl/ /something/perl/ <Location /perl/> SetHandler perl-script # PerlHandler Apache::Registry (module isn't available so this + is commented out) PerlHandler ModPerl::Registry #PerlSendHeader On order deny,allow deny from all Options +ExecCGI allow from x.x.x.x </Location> <Location /perl-status> PerlHandler Apache2::Status SetHandler perl-script Allow from x.x.x.x </Location> </VirtualHost>
error_log logs after httpd startup:
[Sun Jun 11 16:14:57 2006] [notice] suEXEC mechanism enabled (wrapper: + /something/something/something/bin/suexec) [Sun Jun 11 16:14:57 2006] [notice] Apache/2.2.2 (Unix) mod_perl/2.0.2 + Perl/v5.8.0 configured -- resuming normal operations
Relative environment var output from "GET /perl-status/?env" :
Embedded Perl version v5.8.0 for Apache/2.2.2 (Unix) mod_perl/2.0.2 Pe +rl/v5.8.0 process 7837, running since Sun Jun 11 15:44:49 2006 Under the "perl-script" handler, the environment is: GATEWAY_INTERFACE = CGI/1.1 MOD_PERL = mod_perl/2.0.2 MOD_PERL_API_VERSION = 2 REQUEST_URI = /perl-status/?env SCRIPT_FILENAME = /something/www/perl-status SCRIPT_NAME = /perl-status

Replies are listed 'Best First'.
Re: Is mod_perl handling requests, or not?
by derby (Abbot) on Jun 11, 2006 at 11:39 UTC

    From mod_perl change file:

    Drop the support for making GATEWAY_INTERFACE special. It's not needed as $ENV{MOD_PERL}, available in both mod_perl generations, should be used to test whether the code is running under mod_perl. Stas

    -derby

        GATEWAY_INTERFACE is defined in the CGI spec and from the spec

        The Common Gateway Interface (CGI) is a simple interface for running external programs

        There's nothing external about any of the mod_xxxs ... so in this case, mod_perl is doing the right thing. Your server still supports cgi ... you're just not using it.

        The environment variables are not about what the server *did* but what it *can do*.

        -derby