perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Wiles <fr...@wiles.org>
Subject Re: modperl and DBI or DBD with mysql
Date Sat, 04 Feb 2006 17:10:59 GMT
On Sat, 04 Feb 2006 20:45:05 +1300
Derek Robson <robsonde@ihug.co.nz> wrote:

> I am new to the world of modperl.
> 
> Any help would be nice.
> 
> I have some perl code that runs fine from the command line but not 
> with modperl.
> 
> #!/usr/local/bin/perl
> use strict;
> use DBI;
> print "Content-type: text/plain\n\n";
> print "check1";
> # Connect to the database.
>    my $dbh = 
> DBI->connect
> ("DBI:mysql:database=answerguy;host=elmo.elmo.theanswerguy.co.nz",
> "robsonde", "ur4xgod", {'RaiseError' => 1});
  
  You want to put a die statement here to test if you are connecting
  to your database.  Something like: 

  my $dbh = DBI->connect( ........... ) or 
      die "Cannot connect to database: $!"; 

  As I bet this is your problem. You won't get any errors in your Apache
  log without using warn(), die(), croak(), or carp() because unless you
  do, to parody the Matrix, "There is no error". :) 

  Hope this helps. 

 ---------------------------------
   Frank Wiles <frank@wiles.org>
   http://www.wiles.org
 ---------------------------------


Mime
View raw message