tu regarde ce qu'il y a dans deux variables différentes, l'une contient un flux l'autre une chaine vide c'ets un grosse différence.
a tout hasard ajoute $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
<?php
$stream = ssh2_exec($connection, "nano /opt/test.txt", 'xterm');
if ($stream !== false)
{
$errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
$retourssh = stream_get_contents($stream);
var_dump($errorStream);
}
?>
@+