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

i can't seem to get mod_perl working right (using the pre-compiled mod_perl/apache in osx 10.3)

any perl script i hit, comes up blank -- no errors or anything -- it just doesn't print anything to the request (not even hello world!), and the browser gets a 'no data / empty document'

no errors in apachelog or errorlog
if i run a script that opens a file/writes to it -- that action is done.
apache seems to have multiple requests at the same moment -- as if every child process is trying to process the script. this only happens when mod_perl is enabled for that directory though. i have this in httpd.conf:
<Directory /webserver/documents/> Options All Indexes FollowSymLinks MultiViews ExecCGI AllowOverride None Order allow,deny Allow from all SetHandler perl-script PerlHandler Apache::PerlRun PerlSendHeader On </Directory>
any suggestions?

Replies are listed 'Best First'.
Re: need help getting apache/mod_perl right
by talexb (Chancellor) on Nov 09, 2003 at 01:22 UTC

    Since I've done a little something along those lines, try the following:

    • Crank up the warnings in your httpd.conf file. I like to see some action in the error and access logs. You should at least be able to see the page being requested in the access log.
    • Try telnetting into port 80 to see if you are getting anything.
    • Try running the scripts from the command line. You may have to su to apache to get this to work.
    Good luck.

    --t. alex
    Life is short: get busy!
Re: need help getting apache/mod_perl right
by CountZero (Bishop) on Nov 09, 2003 at 08:42 UTC
    What version of Apache and mod_perl are you using?

    Do your scripts work if used as simple CGI and not under mod_perl?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: need help getting apache/mod_perl right
by perrin (Chancellor) on Nov 10, 2003 at 04:37 UTC
    URLs will often show multiple times in the access log because they are going through multiple phases (URI translation, auth, etc.).

    Some suggesstions:

    • Telnet to the server or use GET (from LWP) so that you can see the actual headers and HTTP traffic coming from the server.
    • Make sure you loaded Apache::PerlRun.
    • Turn on warnings: PerlWarn on.
    • Did you really mean to make everything under /webserver/documents, including any images there, run though Apache::PerlRun? That is what you've done here.
Re: need help getting apache/mod_perl right
by nmerriweather (Friar) on Nov 09, 2003 at 18:25 UTC
    pages don't go to the error log -- they're in the access log apparently 10 times from 1 request. any file stuff works -- lets say the script it this:
    print "ContentType: text/plain \n\n"; open FILE, '> a.txt'; print FILE 'hello world'; close FILE; print 'hello world';
    a.txt will be written. no text will be served by apache.
    everything runs fine command line
    everything runs fine as a regular cgi
    everything runs (*&#$ as mod_perl
Re: need help getting apache/mod_perl right
by simonm (Vicar) on Nov 09, 2003 at 17:22 UTC
    Perhaps unrelated, but if you're using the default Apple settings that include "WebPerfCacheEnable On", your Apache instance is probably running on a high port, like 16080... You might try taking a look at your conf and accessing the script directly using that high port number to circumvent the webperfcache process to see if that makes a difference.