You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Roman <ro...@free.fr> on 2005/02/11 07:37:09 UTC

undefined symbol 'mysql_close' lazy binding failed!

Hi all, I'm new to mod_perl and to this mailing list. I use mod_perl for 
that mass virtual hosting through MySQL, I used this wonderful howto : 
http://davidcoulson.net/writing/lxf/39/apache.pdf

So my httpd.conf contains that :
---------------------
<Perl>
  package My::MySQLTrans;
use Apache::DBI;
use DBI;
  use Apache::Constants qw(:common);
  
Apache::DBI->connect_on_init("DBI:mysql:iglou:localhost","iglou","xxxxx", {
                                                                
PrintError => 1, #warn() on errors
                                                                
RaiseError => 0, #don't die on error
                                                                
AutoCommit => 1, #commit executes immediately
                                                                });
$dbh=DBI->connect("DBI:mysql:iglou:localhost","iglou","THVOn0T3");
  sub get_hosting_info {
    my $h = shift;
    $h =~ tr/[A-Z]/[a-z]/;
    if($h =~ /^www\.(.+)$/) {
      $h=$1;
    }
    $sth=$dbh->prepare("SELECT dir FROM webaliases WHERE alias='".$h."'");
    $dbh->{mysql_auto_reconnect} = 1;
    $sth->execute();
    if($row=$sth->fetchrow_hashref()) {
      $h=$row->{dir};
    }
    $sth->finish();
    $dbh->disconnect();
    return $h;
  }
  sub handler {
    my $r = shift;
    $u = $r->uri;
    if($u =~ /^\/icons\/.+/) {
      $r->filename("/var/www".$u);
      return OK;
    }
    $h=get_hosting_info($r->hostname);
    if($1 eq "cgi-bin") {
      $r->content_type("application/x-httpd-cgi");
    }
    $r->document_root("/var/www/users/".$h);
    $r->filename("/var/www/users/".$h.$u);
    $r->subprocess_env(VHOST=>$h);
    return OK;
  }
</Perl>
PerlTransHandler My::MySQLTrans
---------------------

I'm running OpenBSD 3.6 with Apache 1.29 and the needed perl modules 
(DBD::MySQL, DBI and some other ones) and when I just restarted the PC, 
Apache works well with these settings, but if I do an "apachectl 
graceful" or "apachectl restart", then I get this message in the error_log :

/usr/sbin/httpd:/usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBD/mysql/mysql.so: 
undefined symbol 'mysql_close' lazy binding failed!

(apache starts normally if I put another httpd.conf that doesn't 
contains any perl code, for exemple just mod_rewrite stuff)

It's the same if I try "apachectl stop" then "apachectl start" : apache 
writes it to the error_log and it doesn't start.
Where does this error come from ? How to fix it ?

Another thing is that before I set "$dbh->{mysql_auto_reconnect} = 1;", 
I had errors like that in the error_log : "MySQL has gone away, 
fetchrow_hashref without execute()" (I don't remember exactly).
I found that I must start MySQL with --skip-reconnect but MySQL doesn't 
work to start with that option.
What must I do to fix that ?

Can you help me please ? I'm lost :-(.
Best regards.