r4 - 07 Apr 2006 - 18:55:48 - IntRigeriYou are here: wiki.boum.org >  Frangipane Web  >  WebSite > PerlSections

Les PerlSections, ou comment configurer Apache en Perl

Ça sert à WebSite.

Sources de doc

Des exemples

Un exemple de Lunar


<Perl>
#!perl

use DBI;

my $db_dbname = "nologweb";
my $db_username = "root";
my $db_password = "";

my $dsn = "DBI:mysql:$db_dbname:localhost";
my $dbh = DBI->connect($dsn, $db_username, $db_password)
    or die("Unable to connect to database: $DBI::errstr");

my $sth = $dbh->prepare(qq{
      SELECT login
        FROM accounts
}) or die("Unable to prepare statement: " . $dbh->errstr);
$sth->execute() or die ("Unable to execute query: " . $sth->errstr);
while (my @data = $sth->fetchrow_array()) {
    my $LOGIN = $data[0];
    my $PATH = "/var/www/w.no-log.org/" . substr($LOGIN, 0, 1) . "/" . 
$LOGIN;
    push @{ $VirtualHost{'*'} },
        { 'ServerName'            => "$LOGIN.w.no-log.org"
        , 'ServerAdmin'           => 'root@globenet.org'
        , 'DocumentRoot'          => "$PATH/public_html"
        , 'php_admin_flag engine' => 'off'
        , 'suPHP_Engine'          => 'On'
        , 'suPHP_ConfigPath'      => "$PATH"
        }; 
}

$sth->finish;
$dbh->disconnect;

</Perl>

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
Frangipane.PerlSections moved from Politburo.PerlSections on 07 Apr 2006 - 18:53 by IntRigeri - put it back
 
Powered by wiki.boum.org
Des idées, requêtes ou problèmes en rapport avec ce wiki ? écris nous !