Execute SSH commands on Cisco router. Codeigniter SSH library
Posted
by
jomajo
on Stack Overflow
See other posts from Stack Overflow
or by jomajo
Published on 2012-06-03T08:36:40Z
Indexed on
2012/06/03
10:40 UTC
Read the original article
Hit count: 202
I have a little problem. I'm using Codeigniter with SSH library written by Shuky (https://bitbucket.org/quicktips/codeigniter-ssh2-library/src/a444968345ba/SSH.php -- You can see the code by following this link).
Everything related with SSH works fine with other devices, but when I try to use this library and execute commands on Cisco devices, nothing happens (commands are not executed). I know that the connection is successful, but I can't execute any commands.
When I try to run and execute comands through SSH on Cisco devices I get this error:
A PHP Error was encountered
Severity: Warning
Message: stream_set_blocking() expects parameter 1 to be resource, boolean given
Filename: libraries/SSH.php
Line Number: 128
A PHP Error was encountered
Severity: Warning
Message: fread() expects parameter 1 to be resource, boolean given
Filename: libraries/SSH.php
Line Number: 129
In the library these lines look like this:
/**
* Get stream data
*
* @access privte
* @return bool
*/
function _get_stream_data($stream) {
stream_set_blocking( $stream, true );
while( $buf = fread($stream,4096) ) {
$this->data .= $buf.'~';
}
return TRUE;
}
line 128 - stream_set_blocking( $stream, true );
line 129 - while( $buf = fread($stream,4096) ) {
Maybe you guys know where the problem is?
Thank you for your time and your answers!
© Stack Overflow or respective owner