I installed the latest version of mod_perl (1.24), linked it statically to
apache 1.3.12. (use perl 5.6). I simply want to access a MySQL database
via the DBI package (v 1.14). I installed ApacheDBI 0.87
I wrote a simple script to access a mysql database. This script works fine,
both from the command line and as a CGI script. The script stops however
at the connect call when I run it as a mod_perl module. I disabled
PerlFreshRestart, because it produced segmentation faults. I found
some similar bug reports in the mailing list archive, but found no postings
about a solution to the problem.
Below I include the script text, and a DBI trace. Who could help? I can
supply more debug information upon request.
The script without a query string provides a popup menu. Hitting the submit
button will actually access the database.
#!/usr/local/bin/perl
use CGI qw/:standard/;
print header,
start_html('Database browser'),
h1('Database browser'),
start_form, "Which video",
p,popup_menu(-name=>'assetid',-values=>['16777267','16777269','16777260']),
submit,
end_form,
hr;
if (param() ) {
print em(join (", " , param('assetid'))), hr;
$assetid = param('assetid');
use DBI;
$Apache::DBI::DEBUG = 1;
#use strict;
DBI->trace(6,"/tmp/dbi.log");
#removed uid / pwd parameters
$dbh = DBI->connect('dbi:mysql:vip;host=', '###', '###');
$sql = "SELECT * FROM spoken_text WHERE asset_id = $assetid";
$sth = $dbh->prepare($sql);
$sth->execute || die "Could not execute SQL statement: $!\n";
while (@rows=$sth->fetchrow_array) {
print "@rows\n\n";
}
}
Here's the trace log from DBI:
DBI 1.14-nothread dispatch trace level set to 6
Note: perl is running without the recommended perl -w option
-> DBI->Apache::DBI::connect(dbi:mysql:vip;host=##, ###, )
-> DBI->install_driver(mysql) for perl=5.006 pid=20105 ruid=6
euid=6
install_driver: DBD::mysql loaded (version 2.0415)
New DBI::dr (for DBD::mysql::dr, parent=, id=)
dbih_setup_handle(DBI::dr=HASH(0x424d10)=>DBI::dr=HASH(0x5c8c20),
DBD::mysql::dr, 0, Null!)
dbih_make_com(Null!, DBD::mysql::dr, 84)
dbih_setup_attrib(DBI::dr=HASH(0x5c8c20), Err, Null!) SCALAR(0x5bdcf8)
(already defined)
dbih_setup_attrib(DBI::dr=HASH(0x5c8c20), State, Null!) SCALAR(0x424fd4)
(already defined)
dbih_setup_attrib(DBI::dr=HASH(0x5c8c20), Errstr, Null!)
SCALAR(0x5bdd10) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x5c8c20), Handlers, Null!)
ARRAY(0x5c8c98) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0x5c8c20), Debug, Null!) 0 (already
defined)
<- install_driver= DBI::dr=HASH(0x424d10)
<- FETCH= 'mysql' ('Name' from cache) at
/usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 64.
-> connect for DBD::mysql::dr (DBI::dr=HASH(0x424d10)~0x5c8c20
'vip;host=#' '' HASH(0x55c540))
New DBI::db (for DBD::mysql::db, parent=DBI::dr=HASH(0x5c8c20),
id=HASH(0x5c8c50))
dbih_setup_handle(DBI::db=HASH(0x5c8c74)=>DBI::db=HASH(0x5bddc4),
DBD::mysql::db, 422d28, HASH(0x5c8c50))
dbih_make_com(DBI::dr=HASH(0x5c8c20), DBD::mysql::db, 536)
dbih_setup_attrib(DBI::db=HASH(0x5bddc4), Err, DBI::dr=HASH(0x5c8c20))
SCALAR(0x5bdcf8) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x5bddc4), State, DBI::dr=HASH(0x5c8c20))
SCALAR(0x424fd4) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x5bddc4), Errstr,
DBI::dr=HASH(0x5c8c20)) SCALAR(0x5bdd10) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x5bddc4), Handlers,
DBI::dr=HASH(0x5c8c20)) ARRAY(0x5c8c98) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x5bddc4), Debug, DBI::dr=HASH(0x5c8c20))
0 (already defined)
imp_dbh->connect: dsn = vip;host=#, uid = , pwd = #
imp_dbh->MyLogin: dbname = vip, uid = ###, pwd = #,host = ###, port
= NULL
imp_dbh->MyConnect: host = ##, port = 0, uid = , pwd = #
imp_dbh->MyConnect: client_flags = 0
The error_log from Apache shows some problems, which *could* be related to
mod_perl
[Fri Dec 1 18:47:08 2000] [crit] (13)Permission denied: make_sock: could
not bi
nd to port 80
[Fri Dec 1 18:56:06 2000] [crit] (13)Permission denied: make_sock: could
not bi
nd to port 80
[Tue Dec 5 09:42:27 2000] [crit] (13)Permission denied: make_sock: could
not bi
nd to port 80
[Tue Dec 5 09:42:31 2000] [crit] (13)Permission denied: make_sock: could
not bi
nd to port 80
--
Wessel Kraaij, TNO-TPD
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]