Can't get Perl DBI script to work with mysql on MacOS

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Can't get Perl DBI script to work with mysql on MacOS

Postby zackxu » 03. July 2011 23:02


I installed XAMPP on MacOS (Snow Leopard).

It seems to work, I was able to start Mysql, run a simple PHP script.

I know perl is also part of the installation. Indeed I found a perl script which is part of the installation.
I tried to run it, but it failed.

% pwd
% ./test-select
install_driver(mysql) failed: Can't locate DBD/ in (@INC contains: /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at (eval 52) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at /Applications/XAMPP/xamppfiles/sql-bench/server-cfg line 247
Compilation failed in require at ./test-select line 35.

I tried to modify the @INC, but it didn't seem to work.

Should this thing work out of the box?

One thing I did, which may be related is that I accidentally installed DBI package (not knowing it may be part of the installation already), but I doubt that this was the cause of the above problem.

Should this script work out of the box? Or is there some additional setup I need to do first?

Any tips will be appreciated.
Posts: 1
Joined: 03. July 2011 22:55

Re: Can't get Perl DBI script to work with mysql on MacOS

Postby Kuzeko » 11. July 2011 10:06

I have the very same problem.

On mac osx Snow Leopard with Xampp!

Any suggestion?
Posts: 1
Joined: 11. July 2011 09:53

Re: Can't get Perl DBI script to work with mysql on MacOS

Postby JonB » 11. July 2011 19:39

Question - what version of XAMPP???

On your localhost;
From the XAMPP page (http://localhost/xampp/) : run the Perlinfo() page.

It works like phpinfo() - lists Perl Modules installed and available.

Perl doesn't use a .ini file like PHP. it finds modules based on location in the 'include path' - that is why you have that long, detailed message telling you where Perl 'looked' for your Perl module. It failed on a require statement in a given script.

One more thing - Not all Perl scripts will run with mod_perl. THUS - you might try disabling mod_perl and re-running the script.

I have found that many of the 'freebie' scripts for PEAR and CPAN have not been 'road-tested' in other XAMPP distributions. :shock:

Unfortunately, the XAMPP DL for Mac files on SourceForge don't have manifests ("packing lists") - so I can't tell if that script is part of the current default XAMPP distribution.

Sorry -- don't have a personal Mac to experiment on, but do have lots of experience debugging Perl (and working on Macs - :-) ).

Good Luck

source for

Code: Select all
#!"C:\xampp\perl\bin\perl.exe"  <<== change the shebang

use HTML::Perlinfo;
use CGI qw(header);

$q = new CGI;
print $q->header;

$p = new HTML::Perlinfo;

User avatar
AF Moderator
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 4 guests