Adding php_value etc, so virtualhosts with mod_perl
am 28.05.2008 00:06:20 von Tue TopholmThis is a multi-part message in MIME format.
------_=_NextPart_001_01C8C045.E4CD9440
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi All
I have a small issue, I have this code:
use DBI;
my ($sth, $dbh, $domain, $domainID, $created, $sql, $sqlsa, $alias, =
$path,$settingName,$settingValue);
$dbh =3D DBI->connect("DBI:mysql:xxxx:xxxx","xxx","xxx");
$sth =3D $dbh->prepare("SELECT domainID, domain, created FROM domain =
ORDER BY domainID ASC");
$sth->execute();
while (($domainID, $domain, $created) =3D $sth->fetchrow_array())
{
if($created == 0)
{
system("/bin/mkdir /home/$domain");
system("/bin/mkdir /home/$domain/www");
system("/bin/mkdir /home/$domain/ErrorLog");
system("/bin/cp /home/index.php =
/home/$domain/www/index.php");
system("/bin/chown apache:apache -R /home/$domain");
$sql =3D $dbh->prepare("UPDATE domain SET created =3D 1 =
WHERE domainID =3D $domainID");
$sql->execute();
}
@apacheSettings =3D {ServerName =3D> "$domain",
ServerAdmin =3D> =
"postmaster@$domain",
ServerAlias =3D> "www.$domain",
DocumentRoot =3D> "/home/$domain/www",
ErrorLog =3D> =
"/home/$domain/ErrorLog/$domain-error_log",
CustomLog =3D> qq{"|/usr/sbin/cronolog =
/websitelog/${domain}_access_log.\%Y-\%m-\%d" combined}};
$sql =3D $dbh->prepare("SELECT settingName, settingValue =
FROM settings WHERE domainID =3D $domainID");
$sql->execute();
while (($settingName, $settingValue) =3D =
$sql->fetchrow_array())
{
@apacheSettings{$settingName} =3D $settingValue;
}
push @{ $VirtualHost{'*:80'} },@apacheSettings;
$sqlsa =3D $dbh->prepare("SELECT domain, path FROM =
serveralias WHERE domainID =3D" . $domainID);
$sqlsa->execute();
while (($alias, $path) =3D $sqlsa->fetchrow_array())
{
push@{ $VirtualHost{'*:80'} },
{
ServerName =3D> $alias,
ServerAdmin =3D> =
"postmaster@$domain",
DocumentRoot =3D> $path,
ErrorLog =3D> =
"/home/$domain/ErrorLog/$domain-error_log",
CustomLog =3D> =
qq{"|/usr/sbin/cronolog /websitelog/${domain}_access_log.\%Y-\%m-\%d" =
combined},
};
}
}
$sth->finish();
$dbh->disconnect();
Med venlig hilsen / Kind Regards
Tue Topholm
Device.Webbureau
------_=_NextPart_001_01C8C045.E4CD9440
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
6.5.7638.1">
Hi All
I have a small issue, I have this code:
<Perl>
use DBI;
my ($sth, $dbh, $domain, $domainID, $created, $sql, $sqlsa, $alias, =
$path,$settingName,$settingValue);
$dbh =3D =
DBI->connect("DBI:mysql:xxxx:xxxx","xxx","xxx=
");
$sth =3D $dbh->prepare("SELECT domainID, domain, created FROM =
domain ORDER BY domainID ASC");
$sth->execute();
while (($domainID, $domain, $created) =3D $sth->fetchrow_array())
{
if($created == 0)
{
&=
nbsp; system("/bin/mkdir /home/$domain");
&=
nbsp; system("/bin/mkdir /home/$domain/www");
&=
nbsp; system("/bin/mkdir =
/home/$domain/ErrorLog");
&=
nbsp; system("/bin/cp /home/index.php =
/home/$domain/www/index.php");
&=
nbsp; system("/bin/chown apache:apache -R =
/home/$domain");
&=
nbsp; $sql =3D $dbh->prepare("UPDATE domain SET =
created =3D 1 WHERE domainID =3D $domainID");
&=
nbsp; $sql->execute();
}
&=
nbsp; @apacheSettings =3D =
{ServerName =3D> "$domain",
&=
nbsp; &n=
bsp; =
ServerAdmin =3D> =
"postmaster@$domain",
&=
nbsp; ServerAlias =3D> =
"www.$domain",
&=
nbsp; DocumentRoot =3D> =
"/home/$domain/www",
&=
nbsp; ErrorLog =
=3D> "/home/$domain/ErrorLog/$domain-error_log",
&=
nbsp; CustomLog =3D> =
qq{"|/usr/sbin/cronolog =
/websitelog/${domain}_access_log.\%Y-\%m-\%d" combined}};
&=
nbsp; $sql =3D $dbh->prepare("SELECT settingName, =
settingValue FROM settings WHERE domainID =3D $domainID");
&=
nbsp; $sql->execute();
&=
nbsp; while (($settingName, $settingValue) =3D =
$sql->fetchrow_array())
&=
nbsp; {
&=
nbsp; =
@apacheSettings{$settingName} =3D $settingValue;
&=
nbsp; }
&=
nbsp; push @{ $VirtualHost{'*:80'} },@apacheSettings;
&=
nbsp; $sqlsa =3D $dbh->prepare("SELECT domain, path =
FROM serveralias WHERE domainID =3D" . $domainID);
&=
nbsp; $sqlsa->execute();
&=
nbsp; while (($alias, $path) =3D =
$sqlsa->fetchrow_array())
&=
nbsp; {
&=
nbsp; push@{ =
$VirtualHost{'*:80'} },
&=
nbsp; {
&=
nbsp; &n=
bsp; =
ServerName =3D> $alias,
&=
nbsp; &n=
bsp; =
ServerAdmin =3D> =
"postmaster@$domain",
&=
nbsp; &n=
bsp; DocumentRoot =
=3D> $path,
&=
nbsp; &n=
bsp; =
ErrorLog =3D> =
"/home/$domain/ErrorLog/$domain-error_log",
&=
nbsp; &n=
bsp; =
CustomLog =3D> =
qq{"|/usr/sbin/cronolog =
/websitelog/${domain}_access_log.\%Y-\%m-\%d" combined},
&=
nbsp; };
&=
nbsp; }
}
$sth->finish();
$dbh->disconnect();
</Perl>
Med venlig hilsen / Kind Regards
Tue Topholm
Device.Webbureau
------_=_NextPart_001_01C8C045.E4CD9440--