RE: crash on connect (DBI/mysql) (2)

2000-12-06 Thread Kraaij, Wessel

Bas,
thanks for your comments. They are a first step to solve the problem.

> [DBI script problem skipped]
> 
> > The error_log from Apache shows some problems, which 
> *could* be related to
> > mod_perl
> > 
> > [Tue Dec  5 09:42:31 2000] [crit] (13)Permission denied: 
> make_sock: could
> > not bi
> > nd to port 80
> 
> Uhm, before we try to solve the problem in hand, I don't 
> understand your
> statement of Apache showing *some* problems. What port are you running
> mod_perl server at? 80? do you run a single mod_perl server 
> or is there a
> front-end server?
I run apache/mod_perl as a single httpd server at port 80.
It might be a uid/gid problem. I replaced httpd/httpd (which were just
copied from a different Apache installation) by nobody/nobody.

The server restarts clean now:

[Tue Dec  5 16:05:12 2000] [notice] FastCGI: process manager initialized
(pid 28
76)
[Tue Dec  5 16:05:12 2000] [notice] Apache/1.3.12 (Unix) mod_fastcgi/2.2.8
PHP/4
.0.2 mod_perl/1.24 configured -- resuming normal operations
As you notice, Apache also runs a fastgci module, which I eventually want to
replace by mod_perl applications.
> 
> Second, you should make your code more debug friendly. Replace:
> $dbh = DBI->connect('dbi:mysql:vip;host=', '###', '###');
> with
> $dbh = DBI->connect('dbi:mysql:vip;host=', '###', '###') 
>   or die $DBI::errstr;
> 
> what error do you get?
I modified my code, the error_log shows a seg fault for each call to the
mod_perl script:

[Tue Dec  5 16:05:38 2000] [notice] child pid 2878 exit signal Segmentation
Faul
t (11)
[Tue Dec  5 16:05:40 2000] [notice] child pid 2877 exit signal Segmentation
Faul
t (11)
[Tue Dec  5 16:05:41 2000] [notice] child pid 2879 exit signal Segmentation
Faul
t (11)
[Tue Dec  5 16:05:42 2000] [notice] child pid 2880 exit signal Segmentation
Faul
t (11)
[Tue Dec  5 16:06:42 2000] [notice] child pid 2884 exit signal Segmentation
Faul
t (11)


At least the error_log shows now that mod_perl crashes before being able to
echo the
diagnostic DBI::errstr .


Wessel Kraaij, TNO-TPD

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




crash on connect (DBI/mysql)

2000-12-05 Thread Kraaij, Wessel


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]