[Modules] mod_vhost_dbi: query issues

Hans de Groot hansg at dandy.nl
Mon Jul 17 03:21:52 EDT 2006


Sorry , I cannot help you, but I'd like to mention I get exaclty the
same error. 

I tried altering the source a little but I'm not a C programmer. So I
could not fix it.

The vhost source,module calls a function (something to do with or near
translate name? and an error message complaing about a query returning
more than one row, which is not true!)  that returns nothing or zero or
what ever, this function is propably in the dbi_pool module.  I could
not fix it, and it does seem nobody is reading this list.

First try I used the lib-dbi that comeswith cent-os (6.5) which did not
Than I tried lib-dbi 0.8.1 and it did not work, coz I forgot to install
the libdbi-drivers-0.8.1a.  

After that it seems to do a lot more but it still fails.

This is my mod vhost conf:
LoadModule dbi_pool_module modules/mod_dbi_pool.so
LoadModule vhost_dbi_module modules/mod_vhost_dbi.so

PoolDbiDriver         Server2  mysql
PoolDbiHost           Server2  81.XXX.XXX.XXX
PoolDbiUsername       Server2  vhost
PoolDbiPassword       Server2  *****
PoolDbiDBName         Server2  mod_vhosts
PoolDbiConnMin        Server2  1
PoolDbiConnSoftMax    Server2  1
PoolDbiConnHardMax    Server2  5
PoolDbiConnTTL        Server2  30

<VirtualHost *:80>
    VhostDbiEnabled On
    VhostDbiConnName Server2
    VhostDbiQuery "SELECT ServerName, DocumentRoot, Username FROM vhost_info WHERE ServerName = &{RequestHostname}"

    LogSQLTransferLogFormat AbHhmRSsTUuv
    LogSQLMassVirtualHosting on

    CustomLog /var/www/logs/access_log combined
    ErrorLog /var/www/logs/error_log


This setup should work but it does not.

The module request the domain name  form the database, I can see that in
the mysql log. 
But than the " File does not exist: /ERROR" apears the the http log.

Sorry I cannot be of help, but maybe if more people mention this problem,
the author or some one else could fix this problem.


Hans de Groot

I posted this to http://issues.outoforder.cc/view.php?id=64 as well, but
am unsure if the developer for mod_vhost_dbi still is active there, as the
last activity was around a year ago for that module:

I am running Ubuntu (6.06) Apache 2.0.55, mod_dbi_pool 0.4.0, and
mod_vhost_dbi 0.1.0.

There's a bit of behavior that's confusing.

With ServerName set to "www.domain.com" and the URL visited as "
www.domain.com" I receive this message:

[error] [client *.*.*.*] File does not exist: /ERROR

If, however, I try to access just "domain.com" this is the error received:

[notice] vhost_dbi_translate_name: no host found in database for 'domain.com',
using defaults.

I am confused as to why those are different queries, and why when the query
is correct pages are not served. If we attempt to serve the page using
mod_alias (hostname.domain.com/~account<http://hostname.domain.com/%7Eaccount>)
it works fine.

Also, with the default template being used, I received this messsage:

Syntax error on line 422 of /etc/apache2/apache2.conf:
VhostDbiQuery takes one argument, SQL Query to Execute to find the Domain

So we changed this:

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


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

Any help with this would be greatly appreciated.


Other info:

( +--------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
| id | int(11) | NO | PRI | NULL | auto_increment |
| ServerName | mediumtext | NO | | NULL | |
| DocumentRoot | mediumtext | NO | | NULL | |
| ServerAlias | mediumtext | NO | | NULL | |
| Username | mediumtext | NO | | NULL | |

# mod_vhost_dbi config here:

PoolDbiDriver Server1 mysql
PoolDbiHost Server1 localhost
PoolDbiUsername Server1 *****
PoolDbiPassword Server1 *****
PoolDbiDBName Server1 vhost_dbi
PoolDbiConnMin Server1 1
PoolDbiConnSoftMax Server1 1
PoolDbiConnHardMax Server1 5
PoolDbiConnTTL Server1 30

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

Hans de Groot 
Email: hansg at dandy.nl   www: http://www.dandy.nl

More information about the Modules mailing list