perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: mod_perl app fails to load after browsing several pages
Date Tue, 07 Jun 2005 13:46:37 GMT
diarmuid ryan wrote:
> Hi,
> 
> I am having trouble with a modperl app i am currently developing. i browse a
> couple of pages
> and perform a few actions but after a short time i am getting a blank
> response from the server, see access log below, which indicates nothing in
> the bytes returned part. no errors show in the error logs. this is happening
> to me both with apache 1.3/modperl 1 and apache 2/mod perl 2. but it happens
> on various different pages, not any one in particular. so my guess is that
> it is the start script that hasa problem. any help in trying to troublshoot
> this would be most helpful.
> 
> thanks in advance
> diarmuid
> 
> 
> 
> apache access log
> ============================================================================
> =====================
> 192.168.0.2 - - [07/Jun/2005:14:37:49 +0100] "GET
> /perl/schoolweb.cgi?action=ManageNews HTTP/1.1" 200 -
> ============================================================================
> =================
> script
> ===================================================
> #!/usr/bin/perl -w
> 
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);

drop that line above. It sends all errors to the browser instead of 
error_log. Now try again. What does error_log say.

> use strict;
> 
> use lib '/srv/www/admin.schoolweb.ie/perl';
> 
> use SchoolWeb::Base;
> 
> $CGI::POST_MAX = 1024 * 1500;
> 
> srand;
> 
> BEGIN {

You can't do that. BEGIN compiles things once and will only be run on the 
first execution. Drop the BEGIN { } block and it should work.

>    my $q = new CGI;
> 
>    my $action = 'SchoolWeb::Actions::' . ($q->param('action') || 'Index');
> 
>    eval "use $action";

When you eval you need to check $@ for errors. See 'perldoc -f eval' for 
more information.

Besides, that code sample is a very very very bad idea. As you eval a 
non-trusted code. You can be hurt. Badly.

Make sure to turn the taint mode (PerlOptions -T in mp2, TaintMode On in 
mp1) and fix your code to untaint your code before eval'ing it.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Mime
View raw message