<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to mod_vhost_dbd</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>Recent changes to mod_vhost_dbd</description><atom:link href="https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 15 Mar 2015 12:19:09 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/feed" rel="self" type="application/rss+xml"/><item><title>Discussion for mod_vhost_dbd page</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Originally posted by: j...@tenka.se&lt;/p&gt;
&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;I wish to pick up different SSL certs from MySQL for different domains. Is it possible with this module? &lt;/p&gt;
&lt;p&gt;Any advice? Pls help. &lt;/p&gt;
&lt;p&gt;Thanks, &lt;/p&gt;
&lt;p&gt;Jon &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 15 Mar 2015 12:19:09 -0000</pubDate><guid>https://sourceforge.net8d5897f518bd9a03769c21b17c7c3c949abc1d8a</guid></item><item><title>Discussion for mod_vhost_dbd page</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Originally posted by: &lt;a class="" href="http://code.google.com/u/114337806062549578903" rel="nofollow"&gt;daveu...@gmail.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Is there a way to handle db connectivity issues? Such as, if communication to the db server isn't functioning, have it fall back to the default docroot rather than throw a server error? &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 15 Mar 2015 12:19:09 -0000</pubDate><guid>https://sourceforge.netb78e05dbb43d4e114ee8bf8974918e29db8ab6c2</guid></item><item><title>Discussion for mod_vhost_dbd page</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Originally posted by: &lt;a class="" href="http://code.google.com/u/117342669942745672053" rel="nofollow"&gt;Thomas.D...@gmail.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A HOSTNAME (or any other) lookup will only be performed once within a single keep-alive connection if all the web page requests use exactly the same SQL query. See: &lt;a href="http://httpd.apache.org/docs/current/mod/core.html#keepalivetimeout" rel="nofollow"&gt;http://httpd.apache.org/docs/current/mod/core.html#keepalivetimeout&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;No other query caching is done by mod_vhost_dbd. Note that most databases, like MySQL, have a query cache to expedite the processing of repeated SQL queries. &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 15 Mar 2015 12:19:09 -0000</pubDate><guid>https://sourceforge.nete34fb2d64feb05d0a697b5f843d490ad64dec844</guid></item><item><title>Discussion for mod_vhost_dbd page</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Originally posted by: &lt;a class="" href="http://code.google.com/u/104820617243884284118" rel="nofollow"&gt;ashishpa...@gmail.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Downloaded and tested, there is no cache. For every single request, a SQL call is made. :-s &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 15 Mar 2015 12:19:08 -0000</pubDate><guid>https://sourceforge.net1bebb3b5864c468284ae6376a08c5584607d8071</guid></item><item><title>Discussion for mod_vhost_dbd page</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Originally posted by: &lt;a class="" href="http://code.google.com/u/104820617243884284118" rel="nofollow"&gt;ashishpa...@gmail.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Does this cache the result for a HOSTNAME lookup, or does it make a call for each request which are coming from various connections? Can we specify a TTL? &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 15 Mar 2015 12:19:08 -0000</pubDate><guid>https://sourceforge.netd66ed054f17279c99ad618d5213827d763684434</guid></item><item><title>mod_vhost_dbd modified by Anonymous</title><link>https://sourceforge.net/p/dbd-modules/wiki/mod_vhost_dbd/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="introduction"&gt;Introduction&lt;/h1&gt;
&lt;p&gt;mod_vhost_dbd has one directive: &lt;/p&gt;
&lt;h4 id="dbdocroot-sql-param"&gt;DBDocRoot SQL &lt;code&gt;[&lt;/code&gt; PARAM ... &lt;code&gt;]&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;mod_vhost_dbd overrides the &lt;a class="" href="http://httpd.apache.org/docs/current/mod/core.html#documentroot" rel="nofollow"&gt;DocumentRoot&lt;/a&gt; directory using an SQL query. &lt;/p&gt;
&lt;p&gt;The query returns the new root directory as the first column of a single result row. If no rows are returned by the query, the original &lt;a class="" href="http://httpd.apache.org/docs/current/mod/core.html#documentroot" rel="nofollow"&gt;DocumentRoot&lt;/a&gt; directory is not replaced. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;DBDocRoot&lt;/span&gt; &lt;span class="s"&gt;"SELECT WebDir FROM WebTable WHERE WebName = %s"&lt;/span&gt;  &lt;span class="n"&gt;HOSTNAME&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;DBDocRoot can be used at the Server or the Virtual Host level. &lt;/p&gt;
&lt;h1 id="details"&gt;Details&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;SQL&lt;/strong&gt; is an SQL statement which returns no more than one row, with the directory in the first column. This directory is used instead of the existing document root set by the &lt;a class="" href="http://httpd.apache.org/docs/current/mod/core.html#documentroot" rel="nofollow"&gt;DocumentRoot&lt;/a&gt; directive. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PARAM ...&lt;/strong&gt; arguments are inserted into the SQL statement at request time. Use one &lt;strong&gt;PARAM&lt;/strong&gt; for each parameter marker in your SQL statement. In the examples, &lt;strong&gt;%s&lt;/strong&gt; is the parameter marker. &lt;strong&gt;PARAM&lt;/strong&gt; may be any of these words (space separated, not case sensitive): &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HOSTNAME&lt;/strong&gt;&lt;br /&gt;
requested hostname&lt;br /&gt;
&lt;em&gt;may be NULL if there is no Host header. e.g. HTTP 1.0 or FTP requests&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IP&lt;/strong&gt;&lt;br /&gt;
server IP address&lt;br /&gt;
&lt;em&gt;as a string, never NULL&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PORT&lt;/strong&gt;&lt;br /&gt;
server port number&lt;br /&gt;
&lt;em&gt;as string, never NULL&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;URI&lt;/strong&gt;&lt;br /&gt;
The request URI&lt;br /&gt;
&lt;em&gt;never NULL&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;URI&lt;code&gt;n&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;where&lt;/em&gt; &lt;strong&gt;&lt;code&gt;n&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;is 1-9&lt;/em&gt;&lt;br /&gt;
Pass only the first &lt;code&gt;n&lt;/code&gt; segments of the URI to the query&lt;br /&gt;
&lt;em&gt;never NULL&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You must have an Apache &lt;a class="" href="http://people.apache.org/~niq/dbd.html" rel="nofollow"&gt;DBD driver&lt;/a&gt; and &lt;a class="" href="http://httpd.apache.org/docs/current/mod/mod_dbd.html" rel="nofollow"&gt;mod_dbd&lt;/a&gt; loaded and configured to use mod_vhost_dbd. &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;a class="" href="http://httpd.apache.org/docs/current/mod/mod_so.html#loadmodule" rel="nofollow"&gt;LoadModule&lt;/a&gt; to enable mod_vhost_dbd. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;LoadModule&lt;/span&gt; &lt;span class="n"&gt;vhost_dbd_module&lt;/span&gt; &lt;span class="n"&gt;modules&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mod_vhost_dbd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;so&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your query returns no rows, the existing document root is used. If your query returns more than one row, the request is rejected with a &lt;em&gt;500 Internal Server Error&lt;/em&gt;. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;Do not put a semicolon at the end of your SQL statement. &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PARAM&lt;/strong&gt; names can be repeated as necessary. For example: to only look up hosts containing ".acme." for port 80 requests: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        &lt;span class="n"&gt;DBDocRoot&lt;/span&gt; &lt;span class="s"&gt;"SELECT DocRoot FROM myTable WHERE %s LIKE '%%.acme.%%' AND Host = %s AND %s = 80"&lt;/span&gt; &lt;span class="n"&gt;HOSTNAME&lt;/span&gt; &lt;span class="n"&gt;HOSTNAME&lt;/span&gt; &lt;span class="n"&gt;PORT&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;DBDocRoot&lt;/strong&gt; can use the name of a statement previously defined with the &lt;a class="" href="http://httpd.apache.org/docs/current/mod/mod_dbd.html#dbdpreparesql" rel="nofollow"&gt;DBDPrepareSQL&lt;/a&gt; directive as the &lt;strong&gt;SQL&lt;/strong&gt; parameter. For example: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;DBDPrepareSQL&lt;/span&gt; &lt;span class="s"&gt;"SELECT WebDir FROM WebTable WHERE WebName = %s"&lt;/span&gt;  &lt;span class="n"&gt;HostLookup&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;DBDocRoot&lt;/span&gt; &lt;span class="n"&gt;HostLookup&lt;/span&gt;  &lt;span class="n"&gt;HOSTNAME&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Some databases (for example: Firebird) may report errors when statements for &lt;strong&gt;DBDocRoot&lt;/strong&gt; are prepared with &lt;a class="" href="http://httpd.apache.org/docs/2.3/mod/mod_dbd.html#dbdpreparesql" rel="nofollow"&gt;DBDPrepareSQL&lt;/a&gt;. In this case, &lt;a class="" href="http://httpd.apache.org/docs/current/mod/mod_dbd.html#dbdpreparesql" rel="nofollow"&gt;DBDPrepareSQL&lt;/a&gt; cannot be used for virtual host statements. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;For Apache 2.2 prior to version 2.2.9, use parameter markers appropriate to your database. For example: Use &lt;strong&gt;?&lt;/strong&gt; for &lt;a class="" href="http://odbc-dbd.googlecode.com" rel="nofollow"&gt;ODBC&lt;/a&gt; or SQLite. Use &lt;strong&gt;%s&lt;/strong&gt; for MySQL, etc. &lt;/li&gt;
&lt;li&gt;For Apache 2.2.9+ always use &lt;strong&gt;%s&lt;/strong&gt; as a parameter marker in your SQL statement. If your SQL statement contains other &lt;strong&gt;%&lt;/strong&gt; characters (for example, in a LIKE clause), use &lt;strong&gt;%%&lt;/strong&gt; to prevent them from being misinterpreted as parameter markers. &lt;/li&gt;
&lt;li&gt;For Apache 2.2.9+, any additional columns which are returned will set an &lt;a class="" href="http://httpd.apache.org/docs/current/env.html" rel="nofollow"&gt;environment variable&lt;/a&gt; with the same name as the column name. If the column value is NULL, any existing &lt;a class="" href="http://httpd.apache.org/docs/current/env.html" rel="nofollow"&gt;environment variable&lt;/a&gt; which matches the column name will be unset. &lt;/li&gt;
&lt;li&gt;Using a URI &lt;strong&gt;PARAM&lt;/strong&gt; increases the number of database queries required because each request requires a new query. Using only the leading portion of the URI can reduce the number of database queries required. When multiple requests are made on the same keep-alive connection which have the same URI&lt;code&gt;n&lt;/code&gt; value, only one query is performed. &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the URI is /alpha/beta/gamma/delta/index.html: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;   &lt;span class="n"&gt;URI1&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;
   &lt;span class="n"&gt;URI2&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beta&lt;/span&gt;
   &lt;span class="n"&gt;URI3&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;
   &lt;span class="p"&gt;...&lt;/span&gt;
   &lt;span class="n"&gt;URI5&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;
   &lt;span class="n"&gt;URI6&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;
   &lt;span class="p"&gt;...&lt;/span&gt;
   &lt;span class="n"&gt;URI9&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;
   &lt;span class="n"&gt;URI&lt;/span&gt;  &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;alpha&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;a class="" href="http://httpd.apache.org/mod_ftp" rel="nofollow"&gt;mod_ftp&lt;/a&gt; is used, an additional &lt;strong&gt;PARAM&lt;/strong&gt; name is available. &lt;strong&gt;FTPUSER&lt;/strong&gt; can be specified to pass the logged-in FTP user name. This parameter is not available for HTTP requests. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;Setting &lt;strong&gt;&lt;a class="" href="http://httpd.apache.org/docs/current/mod/core.html#loglevel" rel="nofollow"&gt;LogLevel&lt;/a&gt; debug&lt;/strong&gt; will print additional information in the Apache error log which can help to diagnose SQL query problems. &lt;/li&gt;
&lt;li&gt;The httpd server variable: &lt;strong&gt;document_root&lt;/strong&gt; is not changed by mod_vhost_dbd. It remains as the value set by the &lt;strong&gt;&lt;a class="" href="http://httpd.apache.org/docs/current/mod/core.html#documentroot" rel="nofollow"&gt;DocumentRoot &lt;/a&gt;&lt;/strong&gt; directive in the httpd configuration file. For example, these variables will contain the directory path set in the httpd configuration file - not the directory path set by &lt;strong&gt;DBDocRoot&lt;/strong&gt;: &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PHP &lt;br /&gt;
&lt;code&gt;$_SERVER['DOCUMENT_ROOT']&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;CGI &lt;br /&gt;
environment variable: &lt;code&gt;DOCUMENT_ROOT&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;J2EE &lt;br /&gt;
&lt;code&gt;GetServletContext().GetRealPath("/")&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 15 Mar 2015 12:19:08 -0000</pubDate><guid>https://sourceforge.neted12850219721a5d1e2687dddeca40172d520398</guid></item></channel></rss>