UnderMine has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am wondering if any one have experienced or got an explaination of the following.

When using DBI and CGI under mod_perl on Apache the following two lines cause a seg fault when in the startup.pl script

use CGI qw(-compile); use DBI;
However the following works OK :-
use DBI; use CGI qw(-compile);
These are the module/versions :-
Apache 1.3.26 mod_ssl 2.8.9 mod_layout 3.0.3 mod_perl 1.26 root@cgi1:/# perl -MDBI -e 'print "$DBI::VERSION\n"' 1.21 root@cgi1:/# perl -MCGI -e 'print "$CGI::VERSION\n"' 2.752
Any help would be welcome
UnderMine

Replies are listed 'Best First'.
Re: DBI and CGI qw(-compile) order causes seg fault
by nite_man (Deacon) on Apr 08, 2003 at 12:14 UTC
    Generally Segmentation fault happens when executes some buggy C or XC code.
    Try to use CoreDumpDirectory directive in your httpd.conf file:
    CoreDumpDirectory /blah/blah/core
    for configure Apache to dump core file to a specific directory and then use a debugger to find out a C function which is causing the problem.
    And maybe more efficient use Apache::DBI for access to a database (It's only my opinion. mod_perl include a lot of useful modules: Apache::File, Apache::DBI etc and if you use mod_perl I think will be better use Apache modules for good performance).
    Good like!
    --------> SV* sv_bless(SV* sv, HV* stash);
      Hi,

      Thanks for the CoreDumpDirectory hint.

      I was giving a mimimal case that repeatably caused the issue. The original case was caused by trying to disable Apache::DBI whilst upgrading it.

      use Apache::DBI; use CGI qw(-compile); use XXXX;
      where XXXX.pm has :-
      use DBI;

      Hope that clears things up.
      UnderMine