[BlueOnyx:10147] Re: Batch Website Changes
Michael Stauber
mstauber at blueonyx.it
Mon Apr 16 11:39:23 -05 2012
Hi Darryl,
> I would like to know if there is a way to make changes to several
> website without changing the setting for each site individually. I would
> like to enable PHP for 130 sites without changing the setting for each
> individually.
Certainly. While regular PHP can also be turned on with the shell tools, those
tools don't support suPHP management yet.
So all in all this small script might help you. Just create it somewhere
(example: "/root/enable_php.pl") and put the following code in it:
------------------------------- Start below: -------------------------------
#!/usr/bin/perl -I/usr/sausalito/perl -I/usr/sausalito/handlers/base/vsite
use CCE;
my $cce = new CCE;
$cce->connectuds();
# Find all Vsites:
my @vhosts = ();
my (@vhosts) = $cce->findx('Vsite');
# Walk through all Vsites:
for my $vsite (@vhosts) {
($ok, my $my_vsite) = $cce->get($vsite);
print "Processing Site: $my_vsite->{fqdn} \n";
($ok) = $cce->set($vsite, 'PHP',{
'suPHP_enabled' => '0',
'enabled' => '1'
});
}
# tell cce everything is okay
$cce->bye('SUCCESS');
exit(0);
------------------------------- End above -------------------------------
Then make the script executeable ("chmod 755 /root/enable_php.pl") and run it
as "root".
It will walk through all Vsites and will enable PHP there.
If you want to enable suPHP instead of "just" PHP, you would change these two
lines ...
'suPHP_enabled' => '0',
'enabled' => '1'
... to this instead:
'suPHP_enabled' => '1',
'enabled' => '1'
--
With best regards
Michael Stauber
More information about the Blueonyx
mailing list