You rock. Thanks much.

On Thu, 01 Dec 2005 08:38:17 +0100
 Tom Schindl <[EMAIL PROTECTED]> wrote:
Hi,

there are many examples how this is working, here is a snippet found in
a mail sent to the list by Andreas Krüger:

httpd.conf:
--------------------------8<--------------------------
<Perl>
use DBI;

# Declare and initialize variables
my $host = 'localhost';
my $db = 'domains';
my $db_user = 'apache';
my $db_password = 'password';
my $server_admin = '[EMAIL PROTECTED]';

# Connect to the requested server
my $dbh = DBI->connect("dbi:mysql:$db:$host", "$db_user", "$db_password");
my $sth = $dbh->prepare("SELECT domain, docroot FROM vhosts ORDER BY domain
ASC");
$sth->execute();

while (($domain, $docroot) = $sth->fetchrow_array()) {
      system("/bin/mkdir -p $docroot");
      system("/bin/mkdir -p $docroot/logs/");
      push @{$VirtualHost{'*'}}, {
              ServerName => "$domain",
              ServerAlias => "www.$domain $domain",
              ServerAdmin => "$server_admin",
              DocumentRoot => "$docroot",
              ErrorLog => "$docroot/error.log",
              CustomLog => ["$docroot/access.log", "combined"],
      };
}
</Perl>
--------------------------8<--------------------------

Tom

JT Smith wrote:
The config files for my application are very detailed. So detailed in
fact that they contain everything necessary to generate a virtual host
from the preloader script. The question is, can I do that? Is it
possible to add virtual hosts on the fly during preload and, if so, how
do I do it? Can anyone point me to an example or at the very least the API?

I saw Apache2::Directive, but that appears to be just for reading from
the config file. Is there something else?

JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com

I reject your reality, and substitute my own. ~ Adam Savage






JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com

I reject your reality, and substitute my own. ~ Adam Savage

Reply via email to