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

I've spent the day reading and re-reading all the CONFIGURE, README, and INSTALL.* docs for both Apache 1.3.12 and mod_perl 1.24. Both seem to build and install just fine, but when I add a Location handler to the Apache config file, I get an error. Here's what I'm adding:
<Location /perl> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI </Location>
When I test the syntax of httpd.conf via "httpd -t", I get this:
Syntax error on line 904 of /usr/local/apache/conf/httpd.conf: Invalid command 'PerlHandler', perhaps mis-spelled or defined by a mod +ule not included in the server configuration
I've obviously fouled up somthing fundamental, but what? The box is RedHat 6.1. I didn't get any errors during the "make" of either Apache or mod_perl.

Replies are listed 'Best First'.
RE: Getting started with mod_perl
by lhoward (Vicar) on May 21, 2000 at 07:22 UTC
    The config fragment you posted looks fine to me. My suspicion is that mod_perl isn't in the httpd that you're running. To verify that mod_perl is compiled into your httpd, do a httpd -l. It will list all the modules compiled into apache. If you do not see mod_perl listed something went wrong with the compile/install.
Re: Getting started with mod_perl
by btrott (Parson) on May 21, 2000 at 07:35 UTC
    I agree w/ lhoward on this one.

    Your configuration there looks fine, so you probably don't have mod_perl built into your httpd. Did you build it in explicitly?

    In addition to using httpd -l, you can also check your error log. When you restart the webserver, you should get a line something like this:

    Apache/1.3.12 (Unix) mod_perl/1.23 configured --...
    If you're not getting the mod_perl stuff, you'll need to compile it in.

    For that, the mod_perl guide is a great source of information on everything mod_perl.

Re: Getting started with mod_perl
by Ian the Terrible (Beadle) on May 21, 2000 at 11:27 UTC

    More info:

    The mod_perl and httpd tarballs were downloaded, un-gzip'd, and un-tar'd to the same parent directory. Then I did:

    % perl Makefile.PL EVERTHING=1 USE_APACI=1 Will configure via APACI Configure mod_perl with ../apache_1.3.12/src ? [y] Shall I build httpd in ../apache_1.3.12/src for you? [y]
    Much hilarity ensued. No errors. Then:
    % make # large amounts of error-free make info % make test # more large amount of error-free text, and then... cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.12/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & httpd listening on port 8529 will write error_log to: t/logs/error_log letting apache warm up...\c done /usr/bin/perl t/TEST 0 still waiting for server to warm up...............not ok server failed to start! (please examine t/logs/error_log) at t/TEST li +ne 95. make: *** [run_tests] Error 9 % [root@mybox mod_perl-1.24] cat t/logs/error_log [Sat May 20 23:24:04 2000] [warn] pid file /home/builds/mod_perl-1.24/ +t/logs/httpd. pid overwritten -- Unclean shutdown of previous Apache run? Constant subroutine XHTML_DTD redefined at /usr/lib/perl5/5.00503/cons +tant.pm line 175. [notice] Destruction->DESTROY called for $global_object [Sat May 20 23:24:06 2000] [warn] [notice] child_init for process 800, + report any problems to [no address given]

    The "pid overwritten" message doesn't surprise me; I've been messing with this all day. It'd be a shock if there wasn't an existing pid file. But the rest of those errors confuse me.

      I'm yet to have the tests in mod_perl run correctly. It always works just fine anyway.

      The first problem is you don't ever seem to run 'make install' on mod_perl. I always install it as per the instructions in INSTALL.apaci, so I can install other modules. This means you have to install apache directly, and activate the module in the apache configure.

        Now we're talking.

        I'd swear that I'd tried that particular install method too, but perhaps not. mod_perl is running now.

        And I was doing the make install - I'm not quite that clueless. I just left it out of the crud I posted because I figured the make test output would be enough. And, it was. Thanks again.
Re: Getting started with mod_perl
by Ian the Terrible (Beadle) on May 21, 2000 at 10:21 UTC

    No longer Anonymous...Dang non-compliant browsers...

    httpd -l shows that mod_perl isn't there, so I've missed something in the install process. I read every install document and readme I could find, but clearly something has escaped me. I'll keep digging, but if anyone has an idea as to what I might have missed, I'd be happy to hear it.

    I've been working with Apache 1.3.4 up 'til now, and there's a list of included modules in httpd.conf in that version. Am I correct in thinking that all of that information is now handled by options at build time?

      Just a potentially helpful thought:
      Restart httpd. You can use the `httpd xxx` way (with xxx=shutdown/start IIRC) or as root, find the first httpd process id with `ps aux |` (probably owned by someone other than nobody) and then do a `kill -USR1 nnnnn` where the n's are the process id. It'll restart in place and regrab httpd.conf ... I hope the problem was that simple. TTFN & Shalom.

      -PipTigger