On Sun, Sep 22, 2002 at 10:33:36AM -0400, Rich DeSimone wrote: > Hi I am just messing around with Perl DBI/Apache and I can't seem to understand this >problem. Right now I am just trying to write a simple CGI perl script that just >displays a mysql query. I am using this code... > > #!/usr/bin/perl -w > > use DBI; > use CGI qw(fatalsToBrowser); > > print CGI::header(); > print "<title>Testing</title>"; > print "<h1>Teams list</h1><br>"; > > my $dbh = DBI->connect("dbi:mysql:hello:localhost:3306", "root", "xxxx"); > my $sth1 = $dbh->prepare("select * from team1"); > > $sth1->execute(); > while(my $team = $sth1->fetchrow_array()){ > print "$team<br>\n";} > > $dbh->disconnect; > > ---------------------------------------------- > Now when I run the file from a shell it queries the database properly and everything >prints out fine. The problem is when I put this file in cgi-bin and try to execute >it via www I am getting an error and this is what the apache error_log is saying... > > [Sat Sep 21 18:21:08 2002] [error] [client 10.0.0.2] Premature end of script >headers: football.pl > [Sat Sep 21 18:21:08 2002] [error] [client 10.0.0.2] Can't locate loadable object >for module DBI in @INC (@INC contains: /usr/local/lib/perl5/5.8.0/i686-linux >/usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux >/usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at >/usr/local/lib/perl5/site_perl/5.8.0/i686-linux/DBI.pm line 243
It sounds like you have two different versions of perl on your machine. One in /usr/bin and the other in /usr/local/bin. Try comparing: /usr/bin/perl -V and /usr/local/bin/perl -V >From there you can decide to get rid of the older perl if you want. -josef