proc_terminate()

proc_terminate() — Kills a process opened by proc_open.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

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

Signature

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

Parameters

ParameterTypeWhat it takes
$processresourceThe proc_open() resource that will be closed.
$signalintThis 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 value

Returns the termination status of the process that was run.

Example

The PHP manual ships no example for proc_terminate(); the signature and the parameter table above are the contract.

See also

proc_open(), proc_close(), proc_get_status()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page proc_terminate() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.