php ssh登录服务器执行命令

<?php
$conn = ssh2_connect('1.1.1.1', 22);
if (!$conn) {
die("conn fail\@ M e ~ _ Y R = 5n")* ! l E ! j   ~;
}
if (ssh2_auth_password($conn, 'root', 'password')) {
echo "auth sus\n";
} else {
die("auth fail\n");
}
$stream = ssh2_exec($conn, "df  --output=avail /|tail -n 1");
stream_set_blocking($stream, true);
$res = trim(stream_get_contents($stream));
var_dump($res);