配置ssh2

时间:2014-05-07 15:49:48

标签: php centos centos6 libssh2

我想删除已执行的cron作业。我使用下面提到的代码,但收到 ssh2 警告。任何建议将不胜感激。

代码

<?php
    $connection = ssh2_connect('host', 22);
    ssh2_auth_password($connection, 'username', 'password');

    $cron1      =   ssh2_exec($connection, 'rm -rf index.php*');

    $stream     =   ssh2_exec($connection, 'df -h*');
    stream_set_blocking($stream, true);
    $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
    echo stream_get_contents($stream_out);
?>

PHP信息() enter image description here

问题

Warning: ssh2_exec(): Unable to request a channel from remote host
Warning: stream_set_blocking() expects parameter 1 to be resource
Warning: ssh2_fetch_stream() expects parameter 1 to be resource
Warning: stream_get_contents() expects parameter 1 to be resource

0 个答案:

没有答案