mapg
July 11, 2015, 8:48pm
1
Hi,
I have a way to get the Process ID in PHP from a process running in windows …
$com = new COM('WScript.Shell');
$exec = $com->Exec($command);
$pid = $exec->ProcessID;
It works very well, my problem is that I ALSO would like to get the STDOUT, and this option doesn’t work
$com = new COM('WScript.Shell');
$exec = $com->Exec($command);
$pid = $exec->ProcessID;
$output = $exec->StdOut->ReadAll;
How can I get both, namely PID and STDOUT?
Thank you in advance for your help!!
Mapg
Not sure if exec is working the same way in the COM object, but according to the exec() function, if you give it an array as the second argument, it will return the output in that array.
$exec = $com->Exec($command, $output);
http://php.net/manual/en/function.exec.php
Scott
mapg
July 13, 2015, 7:58am
3
Hi Scott,
What you replied is a mixture between PHP and COM. I do not think that it could will work.
In any case I need both. Process ID and STDOUT.
Thank you for your reply anyway.
Best,
Mapg
Yeah, it was just a guess. Why doesn’t exec() work? It should AFAIK.
Scott
mapg
July 13, 2015, 11:52am
5
PHP exec is not giving me the real Proces ID.
So it is either solve the problem of no output with COM or solve the problem of getting the real PID with exec.
How about just moving to Linux? LOL!
I found this. http://stackoverflow.com/questions/3679663/how-to-get-pid-from-php-function-exec-in-windows
Not sure it will help.
Scott
system
Closed
October 12, 2015, 7:16pm
7
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.