Hi folks,
I am trying to launch a program with PHP code. I am running Apache on
Windows XP SP2.
I am using the method noted here:
http://us2.php.net/manual/en/function.exec.php#59428
To simplify things, I am trying to launch notepad with the following
line of code:
<?php
exec('C:\PsTools\psexec.exe -d -s notepad.exe 2>&1', $output);
?>
I can see psexec running in the Task Manager, but it does not launch
notepad and does not return control to PHP. If I manually quit psexec
from the Task Manager, PHP will resume executing the script.
Running this from the command line works fine:
C:\PsTools\psexec.exe -d -s notepad.exe 2>&1
If I force quit psexec and do a var_dump() on $output, I see:
array(5) { [0]=string(0) "" [1]=string(41) "PsExec v1.82 - Execute
processes remotely" [2]=string(40) "Copyright (C) 2001-2007 Mark
Russinovich" [3]=string(35) "Sysinternals - www.sysinternals.com"
[4]=string(0) "" }
Note that there is no error message, but the expected output should have
a sixth line something like this:
notepad.exe started on HAL with process ID 4668.
Any ideas on how I can get this to work?