I am creating a background process using proc_open()
and am wondering how to cancel or stop this background process, from a different file or action, while my background process is still running?
Here is my code :
$errorLog = './error.log';
$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", $errorLog, "a") // stderr is a file to write to
);
proc_open("/var/bin/php /home/hello/myscript.php &", $descriptorspec, $pipes);
I already read about proc_terminate($process)
but it seems that requires the returned by proc_open()
to stop the process. Is there any way to stop it without having proc_open()
in the same script?