Specifications
Using mod_auth_mysql Authentication
As already mentioned, using mod_auth with Apache is easy to set up and is effective. Because
it stores users in a text file, it is not really practical for busy sites with large numbers of users.
Fortunately, you can have most of the ease of mod_auth, and the speed of a database using
mod_auth_mysql. This module works in much the same way as mod_auth, but because it uses a
MySQL database instead of a text file, it can search large user lists quickly.
In order to use it, you will need to compile and install the module on your system or ask your
system administrator to install it.
Installing mod_auth_mysql
In order to use mod_auth_mysql, you will need to set up Apache and MySQL according to the
instruction in Appendix A, “Installing PHP and MySQL,” but add a few extra steps. There are
quite good instructions in the files README and USAGE that are in the distribution, but here is a
summary.
1. Obtain the distribution archive for the module. It is on the CD-ROM that came with this
book, but you can always get the latest version from
http://www.zend.com
or alternatively
http://www.mysql.com/downloads/contrib.html
2. Unzip and untar the source code.
3. Change to the mod_auth_mysql directory and run configure. You need to tell it where to
find your MySQL installation and your Apache source code. To suit the directory struc-
ture on my machine, I typed
./configure --with-mysql=/var/mysql --with-apache=/src/apache_1.3.12
but your locations might be different.
4. Run make, and then make install. You will need to add
--activate-module=src/modules/auth_mysql/libauth_mysql.a
to the parameters you give to configure when you configure Apache.
For the setup on my system, I used
./configure --enable-module=ssl \
--activate-module=src/modules/php4/libphp4.a \
--enable-module=php4 --prefix=/usr/local/apache --enable-shared=ssl \
--activate-module=src/modules/auth_mysql/libauth_mysql.a
E-commerce and Security
P
ART III
322
18 7842 CH14 3/6/01 3:35 PM Page 322










