You are here: Re: [PHP] Restarting windows from php « PHP « IT news, forums, messages
Re: [PHP] Restarting windows from php

Posted by Richard Davey on 08/10/05 17:26

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

 

Navigation:

[Reply to this 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

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