Well, stream_get_contents function not work with unix signal normally. I use next code instead of "stream_get_contents"
$finisher = "SSH_FINISHED_COMMAND";
$command .= " && echo \"{$finisher}\"";
$command = str_replace(' &&' , ' 2>&1 &&', $command);
$stream = ssh2_exec(
$this->connection,
$command,
$options['pty'],
$options['env'],
$options['width'],
$options['height'],
$options['width_height_type']
);
stream_set_blocking($stream, true);
$block = false;
$isFinished = false;
while (! feof($stream) && ! $isFinished){
$block = fread($stream, 256);
$output .= $block;
$isFinished = substr($output , -strlen($finisher)-2) == $finisher . '\n';
}
$output = str_replace($finisher . "\n", '', $output);
fclose($stream);
return $output;