I'm running a loop that executes the same application once the round is finished, using proc_open, like this:
$description = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "proc_open_errors", "a+")
);
$command = "start /min php $operador_php";
$process = proc_open($command, $description, $pipe);
if (is_resource($process)) {
print_r($process);
sleep(5);
fclose($pipe[0]);
fclose($pipe[1]);
$process_response = proc_close($process);
echo $process_response;
}
The issue I have is that after some hours running, one of the executions may fail in the middle, breaking the whole loop. And it closes itself (on Windows) so I can't see what the problem is.
Is there any way to prevent the PHP CLI from closing itself in case there's an issue? or should I rather use a sequence of "if /else" to check if there's any problem during the execution? Any other idea?