I used pcntl extension in my code like this : I bind a handler to some signal, for example SIGUSR1, and have a script which send signals to my application.
pcntl_signal(SIGUSR1, function ($signo){
echo 'Signal:' . $signo . PHP_EOL;
});
And I have such an error:
stream_get_contents(): Failure 'would block' (-9)
Also I have a code for remote command execution by ssh (part of function) :
$stream = ssh2_exec(
$this->connection,
$command,
$options['pty'],
$options['env'],
$options['width'],
$options['height'],
$options['width_height_type']
);
if ($options['waitOut']) {
stream_set_blocking($stream, true);
If signal is raised here, the following error will occur: "Failure 'would block' (-9)"
$output = stream_get_contents($stream);
}
fclose($stream);
return $output;
Is there any way to avoid this?