suche nach in der

proc_nice> <proc_close
Last updated: Sat, 07 Jan 2012

view this page in

proc_get_status

(PHP 5)

proc_get_statusLiefert Informationen über einen mit proc_open() gestarteten Prozess

Beschreibung

array proc_get_status ( resource $process )

proc_get_status() liefert Daten über einen Prozess, der unter Verwendung von proc_open() gestartet wurde.

Parameter-Liste

process

Die zu untersuchende proc_open()-Ressource.

Rückgabewerte

Im Erfolgsfall wird ein Array der gesammelten Informationen zurückgeliefert, im Fehlerfall FALSE. Das zurückgegebene Array enthält die folgenden Elemente:

Element Typ Beschreibung
command string Der Kommandostring, der an proc_open() übergeben wurde.
pid int ProzessID
running bool Ist TRUE, wenn der Prozess noch läuft, und FALSE wenn er beendet wurde.
signaled bool Ist TRUE, wenn der Child-Prozess durch ein nicht erkanntes Signal beendet wurde. Unter Windows hat das Element immer den Wert FALSE.
stopped bool Ist TRUE, wenn der Child-Prozess durch ein Signal gestoppt wurde. Unter Windows hat das Element immer den Wert FALSE.
exitcode int Der Exitcode, der vom Prozess zurückgegeben wurde (dieser ist nur aussagekräftig, wenn running FALSE ist). Nur der erste Aufruf der Funktion gibt den richtigen Wert zurück, alle weiteren Aufrufe resultieren im Wert -1.
termsig int Die Signalnummer die den Child-Prozess veranlasst hat, seine Ausführung abzubrechen (nur aussagekräftig, wenn signaled TRUE ist).
stopsig int Die Signalnummer, die den Child-Prozess veranlasst hat, seine Ausführung zu stoppen (nur aussagekräftig, wenn stopped TRUE ist).

Siehe auch

  • proc_open() - Führt ein Kommando aus und öffnet Dateizeiger für die Ein- und Ausgabe



add a note add a note User Contributed Notes
proc_get_status
damien at cyg dot net
13-Jun-2007 03:06
Alternatively, if you're calling a subsequent php script using proc_open, you can have that process echo its own actual PID in the output.
Also, if you go through the /proc filesystem on linux, you can read through /proc/12345 where 12345 is the pid returned by proc_get_status (the pid of the /bin/sh instance) and it will list its child processes within.
andy dot shellam at mailnetwork dot co dot uk
05-Apr-2007 02:16
Further to my previous note, I've found out the PID returned is the PID of the shell (/bin/sh) that then runs the actual command requested.

I've raised this as bug #41003.
andy dot shellam at mailnetwork dot co dot uk
05-Apr-2007 01:58
To the poster above, same here on FreeBSD 6.1, PHP 5.2.1.

To get the correct PID to use for posix_kill I have to add 1 to the PID returned from proc_get_status.

proc_nice> <proc_close
Last updated: Sat, 07 Jan 2012