Page 1 of 1

proc_get_status command

Posted: Tue Apr 20, 2004 5:02 am
by Carol
I read in PHP manual about proc_get_status command but I can not use it. Could you give me any example about it. Thanks very much.
Also, do you know how to know what processes are running on Window platform?
Thanks again.
Carol

Posted: Wed Apr 21, 2004 1:50 pm
by Weirdan
hm, may be something like:

Code: Select all

$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
   2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
$process = proc_open("some_program.exe", $descriptorspec, $pipes);
if (is_resource($process)) {
  var_dump(proc_get_status($process));
  proc_close($process);
}
Also, do you know how to know what processes are running on Window platform?
if you have Resource Kit installed on your win box, then something like this is possible:

Code: Select all

echo `tlist`;
Basically, tlist is the console tool intended to show the list of tasks currently beeing executed. Backtick operator are used here to catch the output of this program.