Let's jump straight in, grab ourselves a copy of these
great packages, and get hacking! This isn't simple stuff.
There are lots of options available to you for obtaining,
compiling, and installing the software. Let's deal with MySQL
first, as we'll need it before we get PHP going.
MySQL central is http://www.mysql.com/. As
befits a program of its stature, there are a zillion mirrors
located all over the globe, so do the Internet a favor and
pick the one closest to you.
You've got plenty of choices at this point. If you're a
do-it-yourselfer, then grab the source code. If you're not
that brave, there are some precompiled binaries for other
platforms already available for download.
In addition, there is a shareware version of MySQL for
Windows users. It is an older version of MySQL. If you want
the latest version, you'll have to purchase a license. There
are also ODBC drivers that let your applications talk to
MySQL. Various other exciting bits and pieces are lurking
about on the site, too, so take a look.
The precompiled Unix versions and the Windows version are
as simple as unpacking and going, and they don't require much
explanation. So let's compile from the source code. Windows
users, please keep in mind that you need to run
mysqld in the mysql/bin directory.
Download the compressed file into your source directory and
uncompress and untar it using gzip and tar. The fast way of
doing this is to type:
gunzip < mysql-xxxx.tar.gz | tar xvf -
The xxxx is where you put the version number. This
will create a directory called mysql-xxxx, which contains all
the source files. Move to that directory by typing cd
mysql-xxxx and check out the various README and INSTALL
files. They're lifesavers in sticky situations.
MySQL comes with a handy configuration script. Simply type
./configure and let things take care of themselves.
If you need to specify what happens and where, typing
./configure --help gives you a list of options to
choose from. For example, if you're compiling on a machine
with little memory, you can opt for the
--with-low-memory flag. I like MySQL to install in
one handy directory tree rather then in various locations on
my machine, so I specify an install location with the
--prefix flag.
You can also specify lots of other options, such as what to
compile and what to skip. Let's assume that we want everything
under /usr/local/mysql on our server. This means we'd
type ./configure --prefix=/usr/local/mysql.
The configure script will run and inspect your system and
then build the necessary files to successfully compile. If it
fails, you'll usually get a helpful error message saying why.
Quite often, you'll find the script will fail when it's
looking for threading libraries. Check that you've got
MIT-pthreads installed on your machine, and if not, add them.
Linux users will have to download LinuxThreads. These are
critical libraries that allow MySQL to multithread (i.e., run
multiple versions of itself). Recent distributions of Linux
may already have these libraries installed.
If everything goes according to plan, simply type
make and go get a coffee. MySQL is a complex program
and takes some time to compile. If you get an error, check the
documentation to see if there is anything specific that you've
missed for your particular OS.
Next, type make install and all the necessary
files will be installed in all the necessary spots. Now you're
almost ready to roll! If you are a MySQL virgin and you've
never installed MySQL before, you need to create the default
permissions, so type ... scripts/mysql_install_db to
set these up.
That's it. We're ready to roll. All we need to do is add
the ability to start and stop the server at boot-up and
shutdown times. And yes, there's a script for that as well.
Typing mysql.server start starts the server, and
mysql.server stop stops the server. It's kind of
obvious, really. To start the server manually (so you can play
without rebooting) enter the root directory in your MySQL
installation (/usr/local/mysql) and type bin/safe_mysqld
&.
You're halfway there. Now on to PHP.
next page»