A compatible system. mod_log_sql was authored and tested on systems
+based on Red Hat Linux (Red Hat, Mandrake), but the module should
+easily adapt to any modern distribution. mod_log_sql has also been
+ported successfully to Solaris and FreeBSD.
+
+
Apache 1.2 or 1.3. Ideally you should already have successfully compiled
+Apache and understand the process, but this document tries to make
+it simple for beginners.
+
+
The MySQL development headers. This package is called different things
+on different distros. For example, Red Hat 6.x calls this RPM ``MySQL-devel''
+whereas Mandrake calls it ``libmysql10-devel.''
+
+
MySQL >= 3.23.15 configured, installed and running on either localhost
+or an accessible networked machine. You should already have a basic
+understanding of MySQL and how it functions.
+
+
Optionally, if you want to be able to log SSL information such as
+keysize or cipher, you need OpenSSL and mod_ssl installed.
+
+These installation documents assume a relatively modern GNU/Linux
+scenario. mod_log_sql has been ported to other platforms; following
+are notes on compiling the module for those platforms.
+
+
+No notes are available at present, but they are desired. If you have
+successfully ported mod_log_sql to BSD, please contact the maintaniner, Chris Powell (chris@grubbybaby.com)
+and help fill in this section.
+
+
+No notes are available at present, but they are desired. If you have
+successfully ported mod_log_sql to Win32, please contact
+the maintaniner, Chris Powell (chris@grubbybaby.com) and help
+fill in this section.
+
+
+You need to know the answer to this question before you proceed. The
+answer is pretty straightforward: what have you done in the past?
+If you like all your Apache modules to be dynamic, then you should
+keep doing that. If you're more of an old-school type and prefer to
+compile the modules right into apache, do that. Both methods work
+equally well.
+
+
+FWIW, the DSO method is more modern and increasing in popularity because
+apxs takes care of a lot of dirty little details for you. As you'll
+see below, the static-module method is a little more complex.
+
+
Perform all the following steps as root so that you have install privs,
+etc. Unpack the archive into a working directory.
+
+
+
+
+
+
# tar zxf mod_log_sql.tar.gz -C /usr/local/src
+
+
+# cd /usr/local/src/mod_log_sql
+
+
+
+
Edit Makefile and change the values of the variables in the first
+section.
+
+
+
+
+
These paths are necessary:
+
+
+
+
APACHEINSTALLED:
+
the location where you installed Apache - usually
+/usr/local/apache, 'locate apxs' can help you find it.
+
+
APACHEHEADERS:
+
The location of your Apache header files, find using
+'locate httpd.h'
+
+
MYSQLLIBRARIES:
+
The location of your MySQL libraries, find using
+'locate libmysqlclient.so'
+
+
MYSQLHEADERS:
+
The location of your MySQL header files, find using
+'locate mysql.h'
+
+
+
+
Optional: if you compiled mod_ssl for Apache and want to
+log SSL data such as 'keysize' and 'cipher type':
+
+
+
+
MODSSLHEADERS:
+
the location of your mod_ssl header files, find
+using 'locate mod_ssl.h'
+
+
DB1HEADERS:
+
the location of your db1 header files, find using 'locate
+ndbm.h'
+
+
+
+
+You do not need to compile SSL support into mod_log_sql
+in order to simply use it with a secure site. You only need to compile
+SSL support into mod_log_sql if you want to log SSL-specific
+data such as the cipher type.
+
+
+
+
IMPORTANT: If you are not logging SSL info, comment out MODSSLHDRS
+by putting a # character in front of it:
+
+
+
+
+
+
#MODSSLHDRS=/usr/include/...
+
+
+
+
Instruct apxs to compile the module as a DSO.
+
+
+
+
+
+
# make dso
+
+
You should see output similar to the following:
+
+
in your httpd.conf file. If they are out of order, simply cut-and-paste
+the ``ssl_module'' section so that it is at the top. If you do
+not, you will get this error when you start Apache:
+
+
+
+2.5 Installation as a static module compiled into
+httpd
+
+
+
+
+
+
Perform all the following steps as root so that you have install privs,
+etc.
+
+
Unpack the archive into a working directory.
+
+
+
+
+
+
# tar zxf mod_log_sql.tar.gz -C /usr/local/src
+
+
+# cd /usr/local/src/mod_log_sql
+
+
+
+
Edit Makefile and change the values of the variables
+in the first section.
+
+
+
+
+
These are necessary:
+
+
+
+
APACHEINSTALLED:
+
the location where you installed Apache - usually
+/usr/local/apache, 'locate apxs' can help you find it.
+
+
APACHESOURCE:
+
the location of your Apache sources, find
+using 'locate ABOUT_APACHE'
+
+
APACHEHEADERS:
+
the location of your Apache header files, find using
+'locate httpd.h'
+
+
MYSQLLIBRARIES:
+
the location of your MySQL libraries, find using
+'locate libmysqlclient.so'
+
+
MYSQLHEADERS:
+
the location of your MySQL header files, find using
+'locate mysql.h'
+
+
+
+
Optional: if you compiled mod_ssl for Apache and want to
+log SSL data such as 'keysize' and 'cipher type':
+
+
+
+
MODSSLHEADERS:
+
the location of your mod_ssl header files, find
+using 'locate mod_ssl.h'
+
+
DB1HEADERS:
+
the location of your db1 header files, find using 'locate
+ndbm.h'
+
+
+
+
+You do not need to compile SSL support into mod_log_sql
+in order to simply use it with a secure site. You only need to compile
+SSL support into mod_log_sql if you want to log SSL-specific
+data such as the cipher type.
+
+
+
+
IMPORTANT: If you are not logging SSL info, comment out MODSSLHDRS
+by putting a # character in front of it:
+
+
+
+
+
+
#MODSSLHDRS=/usr/include/...
+
+
+
+
Compile the module.
+
+
+
+
+
+
# make static
+
+
You should see output similar to the following:
+
+
You should see no errors and have a new file called "mod_log_sql.o"
+in your directory.
+
+
+
+
Install the module.
+
+
+
+
+
+
# make statinstall
+
+
+
+
Change to your Apache source directory.
+
+
+
+
+
+
# cd /usr/local/src/apache-1.3.22/src
+
+
+
+
Re-compile your httpd binary as follows.
+
+
+
+
+
Make these changes to Configuration.apaci:
+
+
+
+
+
Append the following string to the EXTRA_LIBS= line. ("/usr/lib/mysql"
+is from step 3, and is where your MySQL libraries
+live):
+
+
+
+
+
+
-L/usr/lib/mysql -lmysqlclient -lm -lz
+
+
+
+
Find the mod_log_config.o line, and insert this line immediately
+after it:
+
+
+
+
+
+
AddModule modules/sql/mod_log_sql.o
+
+
+
+
# cp Configuration.apaci Configuration
+
+
# ./Configure
+
+
# make
+
+
# strip httpd
+
+
+
+
Test your new apache binary:
+
+
+
+
+
+
# ./httpd -l
+
+
You should see something like:
+
+
+
+
+
+
Compiled-in modules:
+
+
+http_core.c
+
+
+mod_log_sql.c <- That's the line you're looking for.
+
+
+mod_env.c
+
+
+mod_log_config.c
+
+
+mod_mime.c
+
+
+mod_negotiation.c
+
+
+etc...
+
+
+
+
Install your httpd binary. Copy it over your old httpd binary, wherever
+it lives. You can and should rename your old httpd first so that you
+can easily revert to that working version in case of bugs with the
+new version.
+
+