Hi all,

I got the following weird problem about DBI in mod_perl.

Just a simple script which can run in the "cgi-bin",but failed in the mod_perl.
When I check the error_log, I find the message:
[Tue Sep 12 12:01:59 2000] [notice] child pid 1273 exit signal Segmentation fault (11)

My linux box:
        perl 5.005_03, 
        Apache/1.3.12 (Unix) with mod_perl/1.24,
        DBI-1.14,
        Mysql 3.22.32

The http.conf about mod_perl:
    Alias /perl/ "/usr/local/apache/cgi-bin/"
    PerlTaintCheck On
    <Location /perl>
        AllowOverride None
        setenv MOD_PERL_TRACE ALL
        PerlSetupEnv Off
        SetHandler perl-script
        PerlHandler Apache::Registry
        PerlModule DBI CGI DBD::mysql
        PerlSetEnv PERL_DESTRUCT_LEVEL -1
        Options +ExecCGI
        Order allow,deny
        Allow from all
    </Location>

The troublesome script is here:
>>>------------------------------------------------------
#!/usr/bin/perl -w

use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
use DBI;
use strict;

my $query= new CGI;
my $dsn="DBI:mysql:database=authuser;host=localhost;port=3306";
my $loginname="test";
my $password="test";
my @table;
my ($dbh,$sth,$fields,$nums,$cols);

print $query->header();
print $query->start_html(-title=>'hello');
print h3({-align=>'center'},"database");
print "<center>";

print "<table border=1>";
print "<tr>";

$dbh=DBI->connect($dsn,$loginname,$password,{RaiseError=>1}) || die "Can't connect!\n";
$sth=$dbh->prepare("describe MemberAuth");
$sth->execute();
# list the column of the table
$fields=$sth->fetchall_arrayref();
        foreach $nums (@$fields) {
                foreach $cols (@$nums[0]) {
                print "<td width=150 align=center>",$cols,"</td>";
        }
}
print "</tr>";

$sth=$dbh->prepare("select * from MemberAuth");
$sth->execute();
# show the records of the table
while(@table=$sth->fetchrow_array()) {
        print "<tr>";
        foreach my $data (@table) {
               print "<td width=150 align=center>",$data,"</td>";
        }
        print "</tr>";
}
$sth->finish();
$dbh->disconnect;

print "</center>";
print $query->end_html;

>>>---------------------------------------------------------------

Any help will be appreciated!

Reply via email to