note 53691 added to function.ssh2-exec

From: Date: Thu, 09 Jun 2005 12:03:34 +0000
Subject: note 53691 added to function.ssh2-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-90169@lists.php.net to get a copy of this message
If you want to run many exec orders throught ssh2 in the same process using the same variable $stream for exemple and to read the output for each order, you must close the stream after each order else you will not be able to read the next order output. $stream=ssh2_exec($conn_id,"/usr/bin/ls ."); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); if(ereg("public_html",$cmd)){ ........................................... } $stream=ssh2_exec($conn_id,"/usr/bin/ls public_html"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); if(ereg("images",$cmd)){ .......................................... } $stream=ssh2_exec($conn_id,"/usr/bin/ls public_html/images"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); if(ereg("blabla",$cmd)){ .......................................... } ---- Manual Page -- http://www.php.net/manual/en/function.ssh2-exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53691 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53691&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53691&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53691&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53691&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53691&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53691&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90169) next »