0

I want to delete the cron jobs performed. I'm using the below mentioned code but getting ssh2 warnings. Any suggestions will be much appreciated.

Code

<?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 info() enter image description here

Problems

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
colourtheweb
  • 727
  • 2
  • 13
  • 28
  • I don't know where I read this, but I think ssh2 does not working on Windows. If that's not your case, try this: [link](http://stackoverflow.com/questions/15921960/ssh2-exec-not-executing-simple-command) – vsmoraes May 07 '14 at 16:29
  • I have **centOS** not windows. – colourtheweb May 08 '14 at 09:07
  • I think it'd be easier to figure out what's going on with http://phpseclib.sourceforge.net/. eg. http://pastebin.com/RULG7idC The thing with phpseclib is that it provides logging. Once you have the logs if you could edit your post to include them that'd be helpful. – neubert May 12 '14 at 12:21

0 Answers0