mod_vhost_dbi Documentation

Home » Projects » Apache » Mod_vhost_dbi » Docs » mod_vhost_dbi Documentation



mod_vhost_dbi uses the "configure/make/make install" mechanism common to many Open Source programs. Most of the dirty work is handled by either configure or Apache's apxs utility. If you have built Apache modules before, there shouldn't be any surprises for you.

The interesting options you can pass to configure are:

  • --with-apxs=/path/to/apache/dir/bin/apxs

    This option is used to specify the location of the apxs utility that was installed as part of apache. Specify the location of the binary, not the directory it is located in.

  • --help

    Provides a list of available configure options.

./configure --with-apxs=/usr/sbin/apxs2
make install

Integration into Apache

To activate mod_vhost_dbi Just add

LoadModule vhost_dbi_module modules/

to your httpd.conf and restart Apache.

Configuring with Apache

A configuration set is all the parameters that describe one database pool. You can have an unlimited number of configuration sets, and each set can be used concurantly. mod_vhost_dbi has the following directives:

mod_vhost_dbi uses mod_dbi_pool to provide database pooling services. The following is a simple example configuration for both mod_vhost_dbi and mod_dbi_pool.

PoolDbiDriver         Server1  mysql
PoolDbiHost           Server1
PoolDbiUsername       Server1  myuser
PoolDbiPassword       Server1  mypass
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}"