Project

General

Profile

Docs ModVhostDbi » History » Revision 3

Revision 2 (ver, 2011-02-14 06:00) → Revision 3/10 (ver, 2011-02-14 08:24)

h1. Docs:ModDbiVhost Docs:ModVhostDbi 

 *Module: mod_dbi_vhost* mod_vhost_dbi* 

 {{>toc}} 

 h2. Description 

 mod_dbi_vhost mod_vhost_dbi is a modified version of [[mod_vhost_mysql]] which instead uses "libDBI":http://libdbi.sf.net/ to read vhost to document root associations. 

 The syntax is almost identical as that used by [[mod_vhost_mysql]] with the following changes: 

  * Module is named _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._ instead of _mysql-vhost_. 
  * Added variables _dbi-vhost.dbtype_ and _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@ to let the GNU tools find it, or @--with-dbi=/path/to/dbi@ to specify the location. 

 h2. Options 

 *vhost.dbi => ( "db" => "..." )* *dbi-vhost.db* - Required 

 The name of the database for network database connections, or a path to a database filename file for local database implementations (Sqlite). 

 *vhost.dbi => ( "dbtype" => "..." )* *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". 

 Some options include: _mysql_, _pgsql_, _sqlite3_, _freetds_, _sqlite_ 

 *vhost.dbi => ( "sql" => "..." )* *dbi-vhost.encoding* - Required Optional 

 The actual query used to get For example, "@UTF-8@".    This parameter compatibility and available options depend on the document root for a vhost. driver.    Use '?' in place of I use it to tell the hostname, for example: 
 <pre> 
 vhost.dbi += ( "sql" => "SELECT docroot FROM vhosts WHERE host='?'" ) 
 </pre> MySQL DBD to use UTF-8. 

 h2. Common Options 

 *vhost.dbi += ( "user" => "..." )* *dbi-vhost.user* - Optional 

 The username to use for opening a typical network-based database connection. 

 *vhost.dbi += ( "pass" => "..." )* *dbi-vhost.pass* - Optional 

 A password used to authenticate to a database connection. 

 *vhost.dbi += ( "hostname" => "..." )* *dbi-vhost.hostname* - Optional 

 A hostname used in establishing a database connection. 

 *vhost.dbi += ( "port" => i )* *dbi-vhost.sql* - Optional 

 A port number The actual query used to authenticate to get the document root for a database connection. vhost.    If not specified, Use '?' in place of the default hostname, for the specified database type will be used. 

 h2. MySQL-Specific Options 

 *vhost.dbi += ( "encoding" => "..." )* - Optional 

 For example, "@UTF-8@".    This parameter compatibility and available options depend on the driver.    I use it to tell the MySQL DBD to use UTF-8. 

 h2. Sqlite3-Specific Options 

 *vhost.dbi += ( "sqlite3_dbdir" => "..." )* example: 
 <pre> 
 dbi-vhost.sql = "SELECT docroot FROM vhosts WHERE host='?'" 
 </pre>