Obtaining MySQL and Related Software

You must install MySQL if you haven't already done so, but you need to install only those third-party tools that you plan to use:

  • To write Perl scripts that access MySQL databases, you must install the DBI and DBD::mysql modules. If you plan to write Web-based DBI scripts, you'll probably want to install the CGI.pm module as well, and you'll need a Web server. The Apache server is used in this book, but others may work, too.

  • If you want to write PHP scripts, you must install PHP. Normally, PHP is used for Web scripting, which means you also need a Web server. The Apache server is used in this book for PHP.

Precompiled binaries are available for many of the installation packages. Various RPM files are available for Linux. If you prefer to compile software from source or if a binary distribution isn't available for your platform, you'll need a C compiler (C++ for MySQL).

If you have an account with an Internet Service Provider that offers MySQL services, it's very likely that all these packages have been installed already. In that case, you can go ahead and use them and skip the rest of this appendix. Otherwise, the primary distribution points for each of the packages you'll need are shown in the following table. Several of these sites offer mirror sites that provide the same software, but that may be closer to you and result in better download times.

Package Location
MySQL http://www.mysql.com/
Perl modules http://cpan.perl.org/
PHP http://www.php.net/
Apache http://www.apache.org/

The version of a package you install depends on your needs:

  • If you need maximum stability, you probably should be conservative and use the most recent stable version of a package. That gives you the benefit of the newest features and the greatest number of bug fixes without exposing you to experimental code in development versions.

  • If you're interested in being on the cutting edge or you require a feature that's available only in the newest version, you should use the latest development release.

  • For MySQL, pre-built binary and RPM distributions often are built using optimization flags that are better than what the configuration script in the source distribution might figure out by itself. The MySQL developers recommend that you use a binary distribution of MySQL obtained from www.mysql.com if possible. They build distributions using some commercial optimizing compilers to make MySQL even faster.

    Consequently, programs in these distributions may run faster than those you'd compile yourself. In addition, they have extensive experience in avoiding or working around bugs in various compilers that result in generation of incorrect code that prevents MySQL from working properly.

The Web sites for each package indicate which versions are the latest stable releases and which are development releases. They also provide per-version feature change lists to help you decide which release is best for you.

If you are working with binary or RPM distributions, unpacking a distribution is equivalent to installing it because the files are unpacked into the directories where you want them to end up. You may need to be root to unpack a distribution if it installs files in protected directories.

For a source distribution, you can unpack it into the area that you want to use for compiling and then install the software into the desired installation location. You may need to be root to perform the install step, but that should not be necessary for any configuration or compilation steps.

If you are installing from source on UNIX, several of the packages discussed here are configured with the configure utility, which makes it easy to set up and build software on a variety of systems. If a build fails, you may need to rerun configure with different options than those you originally specified. Before doing so, you should prevent configure from picking up information that it saved from the previous time you ran it. Clean out stored the configuration like this:

% make distclean 

or like this:

% rm config.cache 
% make clean

Subscribing to Mailing Lists for Help

When you install a package, it's a good idea to subscribe to the general discussion list for that package so that you can ask questions and receive helpful answers. If you install development releases, you definitely should join and read the mailing list associated with the software to stay abreast of bug reports and fixes. If you don't join a general discussion list, you should at least subscribe to the announcement list so that you receive notices of new releases. Instructions for subscribing to mailing lists and using them are provided in the Introduction. The Web sites for each package also provide subscription information.