ssh2 mod and exec function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gonchi

    ssh2 mod and exec function

    Hi,

    Something very strangne happens with the function ssh2_exec, i can't
    read the stream answer after execution in the remote computer. I work
    with apache 1.3.30 and php 4.3.10 , libssh 2.0.5 . the ssh2 module
    looks to work correctly but sftp functions cause a big delay causing
    server timeout and ssh2_exec can't read the output. Tryed many things
    recommeded in php website and forums but always the first ssh2_exec
    reading success and the following ones fail.

    $stream=ssh2_ex ec($conn_id,'/usr/bin/ls ./public_html');

    I tryed to read the output with:

    stream_set_bloc king( $stream, true );
    $cmd=fread( $stream, 4096 );

    after

    while($line = fgets($stream)) {
    $cmd .= $line;
    }

    and

    while( !feof($stream) ) {
    $cmd .= fgets($stream)
    }

    Nothing success to catch the output for the second execute order. In
    the same process only the first exec could be read.
    Anybody know

Working...