You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by rw...@americom.com on 2000/09/19 11:44:53 UTC

Apache mod-perl fails to execute

I have what must be a very stupid problem...

I cannot get Apache httpd to start when I use DBI in the startup file.

Here are two examples of my startup file.  The first one works (i.e.,
httpd runs).  The second one fails (i.e., httpd won't run.)

1. Startup.pl

#!/usr/bin/perl
# use DBI;
1;

2. Startup.pl

#!/usr/bin/perl
use DBI;
1;

I can run 2. in the perl debugger and it works just fine.

In fact I can run 3. below (in the debugger *and* by running httpd) and
it prints a legitimate count in /tmp/count, but no httpd is running when
it finishes.  So the "use DBI" is working, but the httpd deamon dies
anyway, but only when "use DBI" is present.

3. Startup.pl

#!/usr/bin/perl
use DBI;

open(F, '> /tmp/count)

$Dbh = DBI->connect('dbi:Sybase:server=DECODER;database=Decoder', 'sa', 'myPw');
my $sth = $Dbh->prepare('set rowcount 10 select * from DecoderCity');
$sth->execute;
while (my $r = $sth->fetch) {
    push(@Records, $r);
}
$Dbh->disconnect;
$Dbh = undef;
print F "$#Records\n";
close(F);

I don't know where to begin to debug this.  Any suggestions?

Thanks,
Dick Kreutzer
AmeriCom Inc.

P.S. I know about Apache::DBI but it is not appropriate for my
     application.  Also, I am running Redhad Linux 6.2 (kernel
     2.2.12-20smp) and Apache/1.3.9 (Unix)  (Red Hat/Linux)

Re: Apache mod-perl fails to execute

Posted by "Alexander Farber (EED)" <ee...@eed.ericsson.se>.
rwk@americom.com wrote:
> it finishes.  So the "use DBI" is working, but the httpd deamon dies
> anyway, but only when "use DBI" is present.

Maybe you have to specify the path to Perl modules by setting 
the PERL5LIB in your httpd's environment or by using "use lib
qw (/path/to/modules)" in your script?

> open(F, '> /tmp/count)

  or die "Could not write to file: $!";

Re: Apache mod-perl fails to execute

Posted by rw...@americom.com.
> rwk@americom.com wrote:
> > 
> > open(F, '> /tmp/count)
> 
> ----------------------^^
> 
> Is that just a typo in the email, or is there really a closing '
> missing?

Just a typo in the email...

> > 
> > I don't know where to begin to debug this.  Any suggestions?
> 
> The apache error_log file (usually in /usr/local/apache/logs or
> somewhere around there) should explain the error in full.

If you are referring to the "ErrorLog" file specified in httpd.conf then
I checked it and there were no errors.

> > 
> > Thanks,
> > Dick Kreutzer
> > AmeriCom Inc.
> > 
> > P.S. I know about Apache::DBI but it is not appropriate for my
> >      application.  Also, I am running Redhad Linux 6.2 (kernel
> >      2.2.12-20smp) and Apache/1.3.9 (Unix)  (Red Hat/Linux)
> 
> Best Regards,
> 
> Brian
> 

Re: Apache mod-perl fails to execute

Posted by "Brian S. Craigie" <Br...@necs.demon.co.uk>.

rwk@americom.com wrote:
> 
> open(F, '> /tmp/count)

----------------------^^

Is that just a typo in the email, or is there really a closing '
missing?

> 
> I don't know where to begin to debug this.  Any suggestions?

The apache error_log file (usually in /usr/local/apache/logs or
somewhere around there) should explain the error in full.

> 
> Thanks,
> Dick Kreutzer
> AmeriCom Inc.
> 
> P.S. I know about Apache::DBI but it is not appropriate for my
>      application.  Also, I am running Redhad Linux 6.2 (kernel
>      2.2.12-20smp) and Apache/1.3.9 (Unix)  (Red Hat/Linux)

Best Regards,

Brian