Reply to XP exec background process

Your name:

Reply:


Posted by Shailesh Humbad on 03/02/06 11:53

I was trying to exec a background process on XP using PHP CLI, but could
not get it to work. Suppose the command I want to spawn off is "cmd".
On *nix, it is as easy as putting ampersand "&" at the end of the command.

I tried the following on XP without working.

exec("cmd");
exec("cmd >NUL");
exec("cmd /c cmd");
exec("start /b cmd");

I tried many combination, but on each one, PHP waits for cmd to exit
before continuing.

Doing this in Windows script host (cscript) is simple:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd", 0, False

The "False" parameter causes the Run method to continue immediately
without waiting for the command to finish. So I could make my PHP file
exec a VBS file that does the actual background execution of my command.

PHP exec documentation says it will not wait if output of the command is
redirected somewhere, but this didn't seem to work for me. If anyone
has experience in doing something like this on Windows XP SP2, your
thoughts would be appreciated.

Thanks,
Shailesh

[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

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