Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

perl script in httpd

Discussion in 'General Discussion' started by upsforum, May 28, 2010.

  1. upsforum

    upsforum Well-Known Member

    Joined:
    Jul 27, 2005
    Messages:
    465
    Likes Received:
    0
    Trophy Points:
    166
    Hi All,

    I need of use a script perl in httpd.conf for set dynamic vhosts and I try this script but don't work, I don't know perl script

    PHP:

    <perl>
    #!/usr/bin/perl -w
    local ($ip,$host,$admin,$vroot,$aliases);
    local ($directive,$args);
    open (FILE,"/var/www/vhosts/myuser/conf/vhost-perl.conf");
    while (<
    FILE>) {
            
    next if /^\s*(#|$) / ;
            
    if (/^d+/) {
            (
    $ip,$host,$admin,$vroot,$aliases)=split /\s*,\s*/, $_;
               
    $VirtualHost{ip}= {
                       
    ServerName =>$host,
                       
    ServerAdmin => $admin,
                       
    DocumentRoot => "/var/www/vhosts/myuser/subdomains/beta/httpdocs",
                       
    ErrorLog => "logs/".$host."_error.log",
                       
    TransferLog =>"logs/".$host."_access.log"
                    
    };
                    
    $VirtualHost {$ip} {ServerAlias} =$aliases if $aliases;
                    
    $VirtualHost {$ip} {Port} =$if ($ip=~/:(\d+)$/);
            } 
    elsif ($ip) {
                    (
    $directive,$args)=split / /, $_,2;
                    
    $VirtualHost {$ip} {$directive}=$args;
            }
    }
    close (FILE);
    #_END_
    </perl>
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice