Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mod_perl or /usr/bin/perl, how can I tell 1

Status
Not open for further replies.

NullTerminator

Programmer
Oct 13, 1998
293
US
How can I tell if Apache is actually using mod_perl vs just executing using the perl binary. I don't have root access, but do have access to httpd.conf.

There doesn't seem to be any script-handler directives in httpd.conf

tnx
Jeb
 
Run this perl script via the web. Since mod_perl is normally configured per VirtualHost.
This script will tell you whether that hosts .CGI's are running under CGI or mod_perl.
Code:
#!/usr/bin/perl -w

use strict;

my $is_cgi = $ENV{GATEWAY_INTERFACE} ne ~ m|^CGI-Perl/| ? 1 : 0;

print "content-type:text/html\n\n";

if ( $is _cgi ) {
    print "CGI";
}
else {
    print "mod_perl";
}

M. Brooks
 
Just what I needed. I tweaked script to
Code:
my $is_cgi = $ENV{GATEWAY_INTERFACE} !~ m|^CGI-Perl/| ? 1 : 0;

tnx
\0
 
running apache 2 on FC4, having trouble verifying modperl is handling requests

Test script worked on mod_perl 1.99_08 with win32 indogo distro but I am having problem with FC4.
Apache 2.0.54 modperl 2.02

mod_perl_test.pl say it is built with mod perl but I can't confirm via the ENV{GATEWAY_INTERFACE}

I rebuilt apache with --with-mpm=prefork, did make clean, make, make install. Rebuilt mod_perl with MP_TRACE=1 and MP_APXS=/opt/apache/subversion/bin/apxs then make clean and make and make install

mod_perl_test.pl returns
Code:
Mod_perl test script

Mod_perl is installed on this server: mod_perl/2.0.2

Environment variables
"DOCUMENT_ROOT" = "/opt/apache/subversion/htdocs"
"GATEWAY_INTERFACE" = "CGI/1.1"
"HTTP_ACCEPT" = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
"HTTP_ACCEPT_CHARSET" = "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
"HTTP_ACCEPT_ENCODING" = "gzip,deflate"
"HTTP_ACCEPT_LANGUAGE" = "en-us,en;q=0.5"
"HTTP_CONNECTION" = "keep-alive"
"HTTP_HOST" = "localhost"
"HTTP_KEEP_ALIVE" = "300"
"HTTP_USER_AGENT" = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4"
"MOD_PERL" = "mod_perl/2.0.2"
"MOD_PERL_API_VERSION" = "2"
"PATH" = "/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/jbeasley/bin"
"QUERY_STRING" = ""
"REMOTE_ADDR" = "127.0.0.1"
"REMOTE_PORT" = "58069"
"REQUEST_METHOD" = "GET"
"REQUEST_URI" = "/perl-bin/mod_perl_test.pl"
"SCRIPT_FILENAME" = "/opt/apache/subversion/perl-bin/mod_perl_test.pl"
"SCRIPT_NAME" = "/perl-bin/mod_perl_test.pl"
"SERVER_ADDR" = "127.0.0.1"
"SERVER_ADMIN" = "don.kichline@penske.com"
"SERVER_NAME" = "localhost"
"SERVER_PORT" = "80"
"SERVER_PROTOCOL" = "HTTP/1.1"
"SERVER_SIGNATURE" = "
Apache/2.0.54 (Unix) DAV/2 SVN/1.3.0 mod_perl/2.0.2 Perl/v5.8.6 Server at localhost Port 80
"
"SERVER_SOFTWARE" = "Apache/2.0.54 (Unix) DAV/2 SVN/1.3.0 mod_perl/2.0.2 Perl/v5.8.6"
"UNIQUE_ID" = "EwxHw38AAAEAAGEPH1cAAAAA"

conf file looks like this
Code:
LoadModule perl_module modules/mod_perl.so
ScriptAlias /perl-bin/ "/opt/apache/subversion/perl-bin/"
#PerlTrace r
<Location /perl-bin >
# depracated 1.3 directive
PerlSendHeader On
# depracated? PerlHandler ModPerl::Registry
# tried PerlResponseHandler ModPerl::Registry
# tried SetHandler modperl no luck
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
#PerlOptions +ParseHeaders
</Location>

error_log looks like this after graceful restart
Code:
[Wed May 03 22:21:32 2006] [notice] Apache/2.0.54 (Unix) DAV/2 SVN/1.3.0 mod_perl/2.0.2 Perl/v5.8.6 configured -- resuming normal operations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top