I currently use mod_vhost_dbd to pull a path from MySQL and insert as a docroot for Apache. This allows me to dynamically change customers from a production to a beta copy of our app with a simple db record update. It also greatly reduces our virtual host configuration, since a single vhost block can accommodate all of our subdomains (www. may return /var/www/prod while test. can return /var/www/test, for example).
The problem occurs if there's any disruption in db connectivity. If it doesn't find a valid entry for the subdomain, it fails back to the defined docroot within the virtualhost config. With the current mod_vhost_dbd, the server will throw a 500 error if it can't reach the db server for any reason.
So my question is - has anyone implemented this sort of dynamic docroot setup with another mechanism? Is there a modification we can make to the current mod_vhost_dbd to make it fail to the default virtualhost docroot on not only a missing record, but also a loss of db connectivity?