Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by sjorge: http://wiki.apache.org/httpd/ApacheVirtualHostMysql/hosts%2econf ------------------------------------------------------------------------------ server => 'localhost', database => 'httpd', user => 'apache', - pass => 'wRu3REfr' + pass => 'password' ); my %host = ( http_tmpl => '/srv/httpd/conf/templates/http.tmpl', @@ -73, +73 @@ ); if(not $dbh){ - print "Can't connect to mysql server!\n"; + print "Can't connect to mysql server!\n"; - die $DBI::errstr; + die $DBI::errstr; } # fetch hosts @@ -93, +93 @@ if ($bSSI == 1) { my $ssi = ''; $ssi = $ssi . "<IfModule mod_include.c>\n"; - $ssi = $ssi . "\tAddType text/html .shtml .shtm\n"; + $ssi = $ssi . "\tAddType text/html .shtml .shtm\n"; - $ssi = $ssi . "\tAddOutputFilter INCLUDES .shtml .shtm\n"; + $ssi = $ssi . "\tAddOutputFilter INCLUDES .shtml .shtm\n"; - $ssi = $ssi . "</IfModule>\n"; + $ssi = $ssi . "</IfModule>\n"; $cfg = $ssi . $cfg; } if ($bCGI == 1) { my $cgi = ''; $cgi = $cgi . "ScriptAlias /cgi-bin/ \"%host_dir%/%name%/cgi-bin/\"\n"; - $cgi = $cgi . "<Directory \"%host_dir%/%name%/cgi-bin\">\n"; + $cgi = $cgi . "<Directory \"%host_dir%/%name%/cgi-bin\">\n"; - $cgi = $cgi . "\tAllowOverride None\n"; + $cgi = $cgi . "\tAllowOverride None\n"; - $cgi = $cgi . "\tOptions None\n"; + $cgi = $cgi . "\tOptions None\n"; - $cgi = $cgi . "\tOrder allow,deny\n"; + $cgi = $cgi . "\tOrder allow,deny\n"; - $cgi = $cgi . "\tAllow from all\n"; + $cgi = $cgi . "\tAllow from all\n"; - $cgi = $cgi . "</Directory>\n"; + $cgi = $cgi . "</Directory>\n"; $cgi = $cgi . "<IfModule mod_cgi.c>\n"; - $cgi = $cgi . "\tAddHandler cgi-script .cgi .pl\n"; + $cgi = $cgi . "\tAddHandler cgi-script .cgi .pl\n"; - $cgi = $cgi . "</IfModule>\n"; + $cgi = $cgi . "</IfModule>\n"; - $cgi = $cgi . "<IfModule mod_cgid.c>\n"; + $cgi = $cgi . "<IfModule mod_cgid.c>\n"; - $cgi = $cgi . "\tAddHandler cgi-script .cgi .pl\n"; + $cgi = $cgi . "\tAddHandler cgi-script .cgi .pl\n"; - $cgi = $cgi . "</IfModule>\n"; + $cgi = $cgi . "</IfModule>\n"; $cfg = $cgi . $cfg; } if ($bPHP == 1) { my $php = ''; $php = $php . "<IfModule mod_php5.c>\n"; - $php = $php . "\tAddHandler application/x-httpd-php .php\n"; + $php = $php . "\tAddHandler application/x-httpd-php .php\n"; - $php = $php . "\tAddHandler application/x-httpd-php-source .phps\n"; + $php = $php . "\tAddHandler application/x-httpd-php-source .phps\n"; - $php = $php . "</IfModule>\n"; + $php = $php . "</IfModule>\n"; $cfg = $php . $cfg; } @@ -133, +133 @@ SELECT alias FROM aliases WHERE id = ?; - }) or die $dbh->errstr; + }) or die $dbh->errstr; $alias->execute($id); while ( (my $n) = $alias->fetchrow_array() ) { @@ -146, +146 @@ # validate documentroot if(!-d "$host{'path'}/$name"){ - mkdir("$host{'path'}/$name", 0755); + mkdir("$host{'path'}/$name", 0755); - mkdir("$host{'path'}/$name/_sys", 0755); + mkdir("$host{'path'}/$name/_sys", 0755); - mkdir("$host{'path'}/$name/_sys/logs", 0755); + mkdir("$host{'path'}/$name/_sys/logs", 0755); - mkdir("$host{'path'}/$name/_sys/tmp", 0755); #for php temp directory + mkdir("$host{'path'}/$name/_sys/tmp", 0755); #for php temp directory - mkdir("$host{'path'}/$name/_sys/sessions", 0755); #for php sessions directory + mkdir("$host{'path'}/$name/_sys/sessions", 0755); #for php sessions directory - mkdir("$host{'path'}/$name/httpdocs", 0755); + mkdir("$host{'path'}/$name/httpdocs", 0755); - mkdir("$host{'path'}/$name/cgi-bin", 0755); + mkdir("$host{'path'}/$name/cgi-bin", 0755); system('chown -R apache:apache "'.$host{'path'}.'/'.$name.'"'); }
