in reply to apache + modperl problem

Start out with a more simple test and work up from there.

Your problems could be coming from anywhere (even an incompatibility between the version of the DBI module and your mod_perl).

So start with a handler like this:
package My::Simple; use strict; use warnings 'all'; use Apache2::RequestRec (); sub handler : method { my ($class, $r) = @_; print "content-type: text/html\n\n"; print "<h1>HELLO WORLD!</h1>"; return 0; } 1;# return true:
And in your httpd.conf add the following:
<Perl> use lib '/path/to/your/libs'; </Perl> PerlModule My::Simple <VirtualHost *:80> ServerName www.your-website.com ServerAlias your-website.com SetHandler perl-script PerlResponseHandler My::Simple </VirtualHost>
Restart your Apache httpd server and access yoursite.com/.

In your browser, you should see...

HELLO, WORLD!

...and your logs should not contain any errors.

Once you have confirmed that Perl, Apache and mod_perl are working, you can start debugging your own code, rather than expecting it to be an apache + modperl problem.

Replies are listed 'Best First'.
Re^2: apache + modperl problem
by Anonymous Monk on Aug 18, 2008 at 04:33 UTC
    Hi, Thankyou for your prompt reply. I tried modifying my script until the error was not there. Ive realised when i put "use Template" i get the error and apache crashes. When i don't put it, it works fine. How do i fix it cause i need template toolkit for my work. On my server, template toolkit is working fine. Thank you, Anant
      Sometimes the mod_perl.so Apache module doesn't like some other compiled C Perl modules (like Template or parts of DBI).

      Your best bet is to re-install Template from source. If CPAN tells you that "Template is up to date" just download it manually via wget and unzip/install by hand. That should take care of the problem.
        Did this problem get solved? I am experiencing *exactly* the same problem with exactly the same versions of Perl/Apache/mod-perl. I've tried uninstalling & reinstalling everything but the problem persists.