After upgrading to OSX Mavericks I can't get DBI/DBD to run.
Perl and MySQL are running fine (I can login to mysql and access my tables), but my Perl scripts can't use DBI anymore as the updater removed all of my previously working Perl modules.
I reinstalled DBI and DBD::mysql using CPAN, which installed them to /opt/local/lib/perl5/site_perl/5.12.4/darwin-multi-2level/. After copying the modules (DBI, DBD and everything in "auto") to /Library/Perl/5.16/darwin-multi-2level/ (as the dir used by cpan is not in @INC) my scripts return an Internal Server Error (even with FatalsToBrowser).
The Apache error log says:
dyld: lazy symbol binding failed: Symbol not found: _Perl_Istack_sp_ptr
Referenced from: /opt/local/lib/perl5/site_perl/5.12.4/darwin-multi-2level/auto/DBI/DBI.bundle
Expected in: flat namespace
dyld: Symbol not found: _Perl_Istack_sp_ptr
Referenced from: /opt/local/lib/perl5/site_perl/5.12.4/darwin-multi-2level/auto/DBI/DBI.bundle
Expected in: flat namespace
Premature end of script headers: test.pl
What's the problem here? Maybe because I copied the files? Maybe I should force CPAN to install to /Library/Perl/5.16/ directly? How can I tell CPAN to do so?
Any ideas?
I haven't upgraded to Mavericks because Apple doesn't care about the modifications one does to Apache, PHP or Perl when upgrading the OS – they just remove them all. I don't know if the following list is going to work well for you, but it worked for me with Lion and Mountain Lion:
Install DBI:
sudo cpan App::cpanminus
.sudo cpanm DBI
.Install DBD::mysql:
sudo perl -MCPAN -e 'shell'
.get DBD::mysql
and exit
.cd /usr/local
sudo mkdir lib
cd lib
sudo ln -s /usr/local/mysql/lib/*.dylib .
cd ~/.cpan/build/DBD*/
sudo perl Makefile.PL --testuser='yourmysqluser' --testpassword='yourmysqlpassword'
sudo make
sudo make test
sudo make install
At cd ~/.cpan/build/DBD*/
, by the *
, I mean that you should write the actual path that goes to the files you just downloaded from CPAN. The name of the directory changes depending on the lastest version but it's easy to find it with a simple ls
.
Hope this works for you.
EDIT
This was a compilation I made through several failed attempts, but I think I should name my sources: