O Apache não pode carregar o módulo dbi no mac os x

1

Eu instalei dbd:mysql via cpan . Eu tenho o seguinte script simples:

#!/usr/bin/perl -U
use DBI;
$ds = 'DBI:mysql:project:localhost'; $user = 'root'; $password = '123456';
$db = DBI->connect($ds, $user, $password) or die("Connection error\n");
$res = $db->prepare("SELECT * FROM root");
$res->execute();
while (my @row = $res->fetchrow_array()) { print $row[0]; }
$res->finish();
$db->disconnect();

Quando eu o executo no terminal, tudo está bem. Mas quando me refiro a ele no navegador, ocorre um erro. Log de erros do Apache:

[error] [client 127.0.0.1] install_driver(mysql) failed: Can't load '/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib

[error] [client 127.0.0.1] Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle

[error] [client 127.0.0.1] Reason: image not found at /System/Library/Perl/5.12/darwin-thread-multi-2level/DynaLoader.pm line 204.

Instalei mod_perl e, seguindo as instruções, alterei o httpd.conf :

LoadModule perl_module libexec/apache2/mod_perl.so

PerlModule Apache::DBI

Mas agora não inicia o apache. Registo de erros:

[error] Can't load '/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib\n Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle\n Reason: image not found at /System/Library/Perl/5.12/darwin-thread-multi-2level/DynaLoader.pm line 204.\n at (eval 6) line 2\nCompilation failed in require at (eval 6) line 2.\n

[error] Can't load Perl module DBD::Mysql for server MacBook-Pro-Evgenij.local:0, exiting...

Como resolver este problema?

    
por ifau 19.04.2012 / 12:03

1 resposta

1

Eu criei um link simbólico em /usr/lib/ para /usr/local/mysql-5.5.23-osx10.6-x86_64/lib/libmysqlclient.18.dylib , reconstruí o dbd:mysql e tudo estava funcionando.

    
por 19.04.2012 / 21:25