Docs ModVhostDbi » History » Revision 2
Revision 1 (ver, 2011-02-14 05:55) → Revision 2/10 (ver, 2011-02-14 06:00)
h1. Docs:ModVhostDbi *Module: mod_vhost_dbi* {{>toc}} h2. Description mod_vhost_dbi is a modified version of [[mod_vhost_mysql]] [mod_vhost_mysql] which instead uses "libDBI":http://libdbi.sf.net/ libDBI (from http://libdbi.sf.net/) to read vhost to document root associations. The syntax is almost identical as that used by [[mod_vhost_mysql]] [mod_vhost_mysql] with the following changes: * Module is named _mod_vhost_dbi_, 'mod_vhost_dbi', obviously. * The username parameter is now optional as some database drivers do not require a username. * Parameters are prefixed as _dbi-vhost._ 'dbi-vhost.' instead of _mysql-vhost_. 'mysql-vhost.' * Added variables _dbi-vhost.dbtype_ 'dbi-vhost.dbtype' and _dbi-vhost.encoding_ 'dbi-vhost.encoding' h2. Installation This module is a 3rd party module and is not included in the official distribution. You can download the patch from here: * For lighttpd 1.4.28: http://riverroadcable.com/~doneill/lighttpd-1.4.28-dbi.patch Once applied, run autogen.sh and pass the option @--with-dbi@ --with-dbi to let the GNU tools find it, or @--with-dbi=/path/to/dbi@ --with-dbi=/path/to/dbi to specify the location. h2. Options *dbi-vhost.db* - Required The name of the database for network database connections, or a path to a database file for local database implementations (Sqlite). *dbi-vhost.dbtype* - Required Set this to your database type. This is usually included in the DBD file name. Eg., libdbdmysql.so is "mysql", and libdbdpgsql.so is "pgsql". *dbi-vhost.encoding* - Optional For example, "@UTF-8@". "UTF-8". This parameter compatibility and available options depend on the driver. I use it to tell the MySQL DBD to use UTF-8. *dbi-vhost.user* - Optional The username to use for opening a database connection. *dbi-vhost.pass* - Optional A password used to authenticate to a database connection. *dbi-vhost.hostname* - Optional A hostname used in establishing a database connection. *dbi-vhost.sql* - Optional The actual query used to get the document root for a vhost. Use '?' in place of the hostname, for example: <pre> dbi-vhost.sql = "SELECT docroot FROM vhosts WHERE host='?'" </pre>