Reply to Re: Reboot Linux Service with PHP

Your name:

Reply:


Posted by theGerm on 03/29/07 17:55

On Mar 29, 11:16 am, "petersprc" <peters...@gmail.com> wrote:
> On Mar 29, 11:59 am, "theGerm" <jrmo...@gmail.com> wrote:
>
> > Is it possible for me to restart a service with PHP? I need to run
> > this from a webpage
>
> > /sbin/service squid reload
>
> You could do somethine like:
>
> $cmd = 'sudo /sbin/service squid reload 2>&1';
> exec($cmd, $output, $exitCode);
> if ($exitCode != 0) {
> trigger_error("Command \"$cmd\" failed with exit code $exitCode: " .
> join("\n", $output), E_USER_ERROR);
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -

With this
<?PHP
$cmd = 'sudo /etc/init.d/squid reload 2>&1';
exec($cmd, $output, $exitCode);
if ($exitCode != 0) {
trigger_error("Command \"$cmd\" failed with exit code $exitCode:
" .
join("\n", $output), E_USER_ERROR);
?>

The page stays blank but the server does not seem to reload.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация