Hello Karl-Heinz,

Wednesday, August 10, 2005, 3:05:32 PM, you wrote:

KHCZ> Does anyone have any idea how to restart windows from a php script?
KHCZ> I tried the following:
KHCZ>      exec('SHUTDOWN -r -t 01');
KHCZ> or
KHCZ>      exec('SHUTDOWN /r');

KHCZ> I received the following warning message: Warning: exec():
KHCZ> Unable to fork [SHUTDOWN -r -t 01].

KHCZ> I never used this kind of functions before. What's wrong? In IIS
KHCZ> for "Execute Permissions" I have "Scripts and Executables". What
KHCZ> permissions should I set for the Internet Guest Account? Or
KHCZ> something else caused the problem, not the permissions? Please
KHCZ> help me.:)

While you can call shutdown directly from exec - some things are best
not called like this. PHP will be left hanging waiting for the process
to finish, so you'll get a really nasty shutdown going on without
properly ending your sessions.

You'd be better off looking at COM scripting it to be honest. Or write
a Windows application that does what you require (closes down all
services smoothly, reboots, etc) and exec that, providing your IIS
user has the correct permissions to do so.

The warning most likely comes from IIS, or your php.ini settings - I
just tested "shutdown -i" on Apache (in WinXP) and it ran without any
problems.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 Zend Certified Engineer
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to