[Mod_log_sql] Connection error on Fedora 3 using local socket connection

Darryl Weaver darryl at weaverweb.co.uk
Wed Nov 17 17:26:03 EST 2004

Hi All,

I am having a problem with getting this to work on Fedora 3.
I have a full install (i.e. everything) of Fedora 3.

I have then removed the installed libdbi libraries and drivers (i.e. the
rpms - libdbi, libdbi-dbd-mysql & libdbi-dbd-pgsql that were version

I have then installed the latest versions of libdbi from the website
from source.

So, I now have libdbi 0.7.2 and libdbi-drivers 0.7.1 installed.

I have then downloaded mod_log_sql-1.99 and extracted the source.
I have downloaded both the diff files and patched the source.

I then successfully ran configure and make and make install.

I then set up a new database called apachelogs and a new database user
with create and insert privileges.
I then create the entries for apache, which I do from an include file as

LoadModule log_sql_module modules/mod_log_sql.so
LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
<IfModule mod_ssl.c>
LoadModule log_sql_ssl_module moduels/mod_log_sql_ssl.so
LogSQLLoginInfo mysql://username:password@localhost/apachelogs
LogSQLCreateTables on
LogSQLDBParam socketfile /var/lib/mysql/mysql.sock

I then add a directive to a virtual host of:
LogSQLTransferLogTable access_log

I restart mysql and make sure the debug logging is enabled.

I can log in to the mysql database with the command:
mysql -u username -p password apachelogs

the /var/log/mysqld.log file then shows me the connection and all the
queries OK.

However, when I start apache I get the following in the error_log:

[Wed Nov 17 22:07:22 2004] [notice] suEXEC mechanism enabled (wrapper:
[Wed Nov 17 22:07:23 2004] [notice] Digest: generating secret for digest
authentication ...
[Wed Nov 17 22:07:23 2004] [notice] Digest: done
[Wed Nov 17 22:07:23 2004] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Wed Nov 17 22:07:23 2004] [notice] LDAP: SSL support unavailable
[Wed Nov 17 22:07:28 2004] [notice] mod_python: Creating 4 session
mutexes based on 256 max processes and 0 max threads.
[Wed Nov 17 22:07:29 2004] [error] mod_log_sql: database connection
error: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13)
[Wed Nov 17 22:07:29 2004] [error] mod_log_sql: child spawned but unable
to open database link

I go to the virtualhost and it writes out the SQL statements to
/etc/httpd/logs/mod_log_sql-preserve (not 
/tmp/sql-preserve as I expected from the docs).

Looking at that file that seems to have all the right information.

So, why isn't the module able to connect to the local mysql socket file
when the other mysql apps can do so?

There doesn't seem to be anything wrong with the filename or path and it
is all accessible to the apache user who runs apache.

Any help would be most appreciated as I'm running out of things to try.
I could go back to the pre-installed versions of libdbi, but they do not
meet the requirements as stated (i.e. libdbi >= 0.7).

Software versions are:

Fedora core 3 (plus current updates)
Apache 2.0.52

Install from source:

So, any ideas?


Best Wishes,

Darryl Weaver
Weaver Web Ltd
0870 741 0761

More information about the Mod_log_sql mailing list