php8.5
Home/ Manual/ exec / functions/ proc_terminate

proc_terminate

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Kills a process opened by proc_open

Description

proc_terminate(resource $process, int $signal = 15): bool

Signals a process (created using proc_open()) that it should terminate. proc_terminate() returns immediately and does not wait for the process to terminate.

proc_terminate() allows you terminate the process and continue with other tasks. You may poll the process (to see if it has stopped yet) by using the proc_get_status() function.

Parameters

process

The proc_open() resource that will be closed.

signal

This optional parameter is only useful on POSIX operating systems; you may specify a signal to send to the process using the kill(2) system call. The default is SIGTERM.

Return Values

Returns the termination status of the process that was run.

See Also

Source: reference/exec/functions/proc-terminate.xml · from the official PHP manual (php/doc-en)