ssh,读取命令的内容

时间:2017-08-31 10:45:29

标签: php ssh

我在尝试通过ssh服务器执行命令时遇到此错误

  

警告:stream_get_contents():第12行的C:\ wamp \ www \ monitor \ test.php中的'传输读取'(-43)失败

这是我的代码

<?php
$conn = ssh2_connect("xx.ss.xx.s", 22);
if(!(ssh2_auth_password($conn, "blbla", "blbla"))){
     die('Authentication Failed...');
} else {
    echo "Authentication Successful!\n";
 $stream = ssh2_exec($conn, "dis inter");
 stream_set_blocking($stream, true);
 $result= stream_get_contents($stream);
 echo $result;
 stream_set_timeout($stream, 10);
   fclose($stream);
}

?>

0 个答案:

没有答案