in reply to Re: mod_perl configuration of Apache2
in thread mod_perl configuration of Apache2

Thanks for the reply.

The machine that I was working on is at work and I will not have access to it again until Monday. Thus, I am trying to set up mod_perl on a home machine. Hopefully what I learn at home this weekend will help me at work on Monday morning.

I don't know if the typo was present in apache2.conf or if it was introduced as I was working on my posting. I'll check that early Monday. By following the provided guidance I added the lines to my home machine. This is a machine that I tried to set up mod_perl on about a year ago (unsuccessfully) and therefore I don't have a "clean install" at home.

At home I am getting perl execution, but it is CGI perl and not mod_perl. I know this due to a modified version of the program from page 76 of "MySQL and Perl for the Web" by Paul DuBois (ISBN 0-7357-1054-6). The test program is:
#!/usr/bin/perl -w # FILE: cgi_or_mod-perl.pl use strict; use warnings; use CGI qw(:standard); print header(), start_html ("CGI or mod-perl test"); print "If 'GATEWAY_INTERFACE = CGI/1.1' then regular CGI.<BR>"; print "If 'GATEWAY_INTERFACE - CGI-Perl/1.1' then mod-perl.<BR>"; print "<BR>"; print "========== TESTING ABILITY OF A PERL SCRIPT TO ACCESS ENVIRONME +NT VARIABLES ========<BR>"; print "REMOTE_ADDR = $ENV{REMOTE_ADDR}<BR>"; print "REMOTE_PORT = $ENV{REMOTE_PORT}<BR>"; print "HTTP_REFERER = $ENV{HTTP_REFERER}<BR>"; print "<BR>"; print "========== FULL DUMP OF ENVIRONMENT VARIABLES ==========<BR>"; print map { "$_ = $ENV{$_}<BR>\n"} sort(keys(%ENV)); print "<BR>"; print end_html(); exit (0);
The test code worked well years ago when I used it to set up mod_perl on Debian machines (that also was a pain to get the mod_perl to run).

My current status is:

WORK COMPUTER - Current status is a mystery but the above discovered typo is a possibility. I'll know more Monday morning.

HOME COMPUTER - When a browser hits a perl script the script will execute and the "expected" results will be returned. BUT, THIS WAS CGI PERL AND NOT MOD_PERL. The cause of this is still a mystery and I am working on it.

Thanks,
Bruce

Replies are listed 'Best First'.
Re^3: mod_perl configuration of Apache2
by Bruce32903 (Scribe) on Dec 12, 2009 at 22:22 UTC
    When I run the script from my previous posting I get the following:
    If 'GATEWAY_INTERFACE = CGI/1.1' then regular CGI. If 'GATEWAY_INTERFACE - CGI-Perl/1.1' then mod-perl. ========== TESTING ABILITY OF A PERL SCRIPT TO ACCESS ENVIRONMENT VARI +ABLES ======== REMOTE_ADDR = 127.0.0.1 REMOTE_PORT = 45469 HTTP_REFERER = ========== FULL DUMP OF ENVIRONMENT VARIABLES ========== DOCUMENT_ROOT = /var/www 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 = 127.0.0.1 HTTP_KEEP_ALIVE = 300 HTTP_USER_AGENT = Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv: +1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MOD_PERL = mod_perl/2.0.2 MOD_PERL_API_VERSION = 2 PATH = /usr/local/bin:/usr/bin:/bin QUERY_STRING = REMOTE_ADDR = 127.0.0.1 REMOTE_PORT = 45469 REQUEST_METHOD = GET REQUEST_URI = /perl/cgi_or_mod-perl.pl SCRIPT_FILENAME = /var/www/perl/cgi_or_mod-perl.pl SCRIPT_NAME = /perl/cgi_or_mod-perl.pl SERVER_ADDR = 127.0.0.1 SERVER_ADMIN = webmaster@localhost SERVER_NAME = 127.0.0.1 SERVER_PORT = 80 SERVER_PROTOCOL = HTTP/1.1 SERVER_SIGNATURE = Apache/2.0.55 (Ubuntu) PHP/4.4.2-1build1 mod_perl/2.0.2 Perl/v5.8.7 Se +rver at 127.0.0.1 Port 80 SERVER_SOFTWARE = Apache/2.0.55 (Ubuntu) PHP/4.4.2-1build1 mod_perl/2. +0.2 Perl/v5.8.7

    Based upon the DuBois text I conclude that mod_perl is installed but not being used when the perl code is executed.

    Bruce
      Thank you gmargo. That seems to put an end to my problem. Making this work was so much trouble that I was starting to wonder if I was trying to fix something that wasn't broken. The bad news is that I was. The good news is that you put an end to my suffering and I can move forward knowing that I will have "good" mod_perl code and not "in need of slight rework" CGI code.

      Thank you,
      Bruce