[Modules] mod_vhost_dbi

Marcus Hammar marcus at vispec.se
Sat Feb 5 16:17:13 EST 2005


Hi,

I've been looking for a module like this for quite some time now and I'm
very pleased to finally have found it. I think something like this should be
a default in the Apache server.

However there seems to be something wrong. I always get Apache errormessages
when I try to access my virtual hosts as specified in MySQL. If the host is
present in the SQL table I get the following error in the webbrowser:


***
Some text in local language
***

Error 404
ERROR
Sat Feb 5 13:43:03 2005
Apache/2.0.50 (Linux/SUSE)


And the following in the Apache error log:
==========================================
[Sat Feb 05 13:43:03 2005] [error] [client 213.113.131.200] File does not
exist: /ERROR, referer: http://vhost2.infium.net/


If the host is not present in the MySQL table I receive the standard Apache
homepage.

My conclusion:
==============
* The module is talking to the MySQL, but somehow it fails to read or use
its answer.


I use the following config in httpd.conf
========================================

LoadModule dbi_pool_module /usr/lib/apache2/mod_dbi_pool.so
LoadModule vhost_dbi_module /usr/lib/apache2/mod_vhost_dbi.so

PoolDbiDriver         Server1  mysql
PoolDbiHost           Server1  [my ip]
PoolDbiUsername       Server1  [my username]
PoolDbiPassword       Server1  [my passwd]
PoolDbiDBName         Server1  vhost
PoolDbiConnMin        Server1  1
PoolDbiConnSoftMax    Server1  1
PoolDbiConnHardMax    Server1  5
PoolDbiConnTTL        Server1  30

NameVirtualHost *


<VirtualHost *>
  VhostDbiEnabled On
  VhostDbiConnName Server1
  VhostDbiQuery "SELECT ServerName, DocumentRoot, Username FROM vhost WHERE
ServerName = &{RequestHostname}"
</VirtualHost>


==============================================

What Username should I use in the table? I don't understand why it's even
there.. Some information about the three variables ServerName, DocumentRoot
and Username in the documentation on the homepage would be great.

The sample code(below) on the homepage did not work for me. I got some
error. I don't think Apache (2.0.50) liked the slash.

=========================================
VhostDbiQuery "SELECT ServerName, DocumentRoot, Username " \
			FROM vhost_info WHERE ServerName =
&{RequestHostname}"
=========================================


Best regards

Marcus Hammar

PS. I wouldn't bother you guys if I could figure it out myself... But I feel
like I've tried everything.... ;)





More information about the Modules mailing list