Re: Restarting windows from php

From: Date: Wed, 10 Aug 2005 16:10:38 +0000
Subject: Re: Restarting windows from php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220347@lists.php.net to get a copy of this message
Karl-Heinz Christian Zeck wrote:
Does anyone have any idea how to restart windows from a php script? I tried the following:
     exec('SHUTDOWN -r -t 01');
or
     exec('SHUTDOWN /r');
I received the following warning message: Warning: exec(): Unable to fork [SHUTDOWN -r -t 01].
There are a couple of possible causes here. First I would try this instead...
    system('shutdown -r -t 1 &');
I don't have a windows machine I can restart at the moment to try this, but you might have more luck with system than with exec. Another possible cause is that the user the web server runs as doesn't have sufficient permissions to initiate a restart. While the error you're getting doesn't appear to have anything to do with permissions I would certainly consider it a possibility. -Stuart

« previous php.general (#220347) next »