Databases Reference
In-Depth Information
Installing Perl modules under Mac OS X
Mac OS X comes with a Perl interpreter already installed, so after installing XAMPP
following the instructions earlier in this chapter, you'll have two Perl interpreters on
your system: /usr/bin/perl and /Applications/xampp/xamppfiles/bin/perl . You'll need to
configure the DBI and CGI modules for at least one of these.
Since we use XAMPP for other parts of this topic, our instructions will focus on it. You
can still configure the system default Perl interpreter by typing /usr/bin/perl in place
of /Applications/xampp/xamppfiles/bin/perl in our instructions, but we feel that you'll
have fewer difficulties if you work with the XAMPP installation.
For XAMPP, you need to do two things to ensure a hassle-free DBD MySQL driver
installation. First, to allow the DBD installation process to test the installation process
using the MySQL server, start XAMPP by typing:
$ sudo /Applications/xampp/xamppfiles/mampp start
Then create a symbolic link to the XAMPP MySQL socket file in the default MySQL
socket file location /tmp/mysql.sock , which is where Perl will expect to find it:
$ ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock
Some versions of XAMPP come with permission settings for the /Applications/xampp/
xamppfiles/lib/perl5 directory that don't allow ordinary users to access it, causing mod-
ules to appear missing. To ensure that the permissions are correctly set, type:
$ sudo chmod u=rwx,g=rx,o=rx /Applications/xampp/xamppfiles/lib/perl5
We discussed permission settings in “Restricting access to files and directories,” at the
beginning of this chapter.
You can download and install the DBI module, the MySQL driver, and the CGI module
for the XAMPP Perl installation by typing these commands in turn:
$ sudo /Applications/xampp/xamppfiles/bin/perl -MCPAN -e 'install DBI;'
$ sudo /Applications/xampp/xamppfiles/bin/perl -MCPAN -e 'install DBD::mysql;'
$ sudo /Applications/xampp/xamppfiles/bin/perl -MCPAN -e 'install CGI;'
You may be prompted for the system root user password. You may also be prompted
to configure the download locations with the message:
Are you ready for manual configuration? [yes]
Unless you're very sure of what you're doing, just type no and press the Enter key to let
Perl figure out how best to download the required files.
Problems installing the Perl modules
If, during the install process, you see an error message such as this one:
Error: Unable to locate installed Perl libraries or Perl source code.
It is recommended that you install perl in a standard location before
 
Search WWH ::




Custom Search