Hello there,

I've just installed Apache 2.0.53 with Mod-Perl 2.

I'm trying to write a virtual host system in Perl but I get this error upon
starting Apache.

Starting web server: Apache2/usr/sbin/apache2ctl: line 99:  2799
Segmentation fault      $HTTPD -k start -DSSL


Setup:
------
Apache/2.0.52 (Debian GNU/Linux) 
PHP/5.0.3 
mod_perl/1.999.21 
Perl/v5.6.1

Installed relevant packages:
----------------------------
libdbd-mysql-perl 
libgdbi-dev
libdbi-perl

Httpd.conf:
-----------
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
PerlModule Apache2

Line which crashes the machine:
-------------------------------
my $dbh = DBI->connect("dbi:mysql:$db:$host", "$db_user", "$db_password");


Script:
-------
<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>


If I out comment this script totally, the server runs fine with mod_perl.

Best Regards,
Andreas

Reply via email to