List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:June 18 1999 12:44pm
Subject:Re: DBI and CGI
View as plain text  
"H.K." wrote:
> 
> This message was sent from Geocrawler.com by "H.K." <webcouture@stripped>
> 
> Running perl script from command line works, but it fails if running under httpd
> (cgi)! Why?
> 
> Basic information: Linux 6.0 (Suse distrubition) Kernel 2.0.36, MySQL 3.22.23, DBD
> MySQL 1.2018, DBI 1.08, (or DBD MySQL 1.2200, DBI 1.10), Apache without modifications,
> initial-MySQL-definitions based on mysql_install_db
> 
> Script:
> ...
> use DBI;
> my $dbh=DBI->connect('DBI:mysql:test', 'root','') ||
>                   print "1st ERROR: ${DBI::errstr}";
> 
> my $sth = $dbh->prepare( 'select * from tsttab' );
> 
> $sth->execute ||
>                  print "2nd ERROR: ${DBI::errstr}";
> 
> my @result = $sth->fetchrow_array;
> ...
> 
> Content of MySQL-log after processsing script via command line:
> 4 Connect    root@localhost on test
> 4 Query      select * from tsttab
> 4 Quit
> 
> Content of MySQL-log after processsing script via cgi:
> 5 Connect    root@localhost on
> 5 Query      select * from tsttab
> 5 Quit
> 
> In this case following error appears (2nd error):
> Content of httpd.error_log: "DBD::mysql::st execute failed: ase Selected at
> /usr/local/httpd/cgi-bin/.....  line xx."
> 
> Q1. Only a fragment of the real errormessage is displayed. I think it means something
> like:  "No Database selected".
> Q2. At MySQL-log I'm missing something like: "Init DB test" or "Connect
> root@localhost on test".
> 
> I dont't know it is neccessary for you to know, my httpd.conf file contains following
> entries belonging to perl:
> 
> :AddModule mod_perl.c
> :AddHandler perl-script .pl
> 
> (It is possible to run other perl-cgi-scripts communicating with Interbase 4.0 with
> IBPerl at the same server,  but I need Mysql)
> 
> 

The only thing I can think of is that you are not running the same
script. In situation like that I do a noze pincher (the stuff you do to
test if you are dreaming) - make the program do something obvious to
show its identity ( print something to stdout), and then see if both
executions print the same thing.

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
DBI and CGIH.K.18 Jun
  • Re: DBI and CGISasha Pachev18 Jun
  • Re: DBI and CGIRonald Beck19 Jun
Re: DBI and CGIAdam19 Jun
Re: DBI and CGIWebcouture20 Jun
Re: DBI and CGIWebcouture20 Jun