note 107325 added to function.ssh2-exec
| From: | cuisdy at gmail dot com | Date: | Tue, 31 Jan 2012 03:43:54 +0000 |
| Subject: | note 107325 added to function.ssh2-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185804@lists.php.net to get a copy of this message | ||
@christopher dot millward
This worked for me, to get both stdout and stderr:
<?php
// $ssh2 is a resource returned by ssh2_connect()
// $cmd is any command you want to exec remotely
$stdio = ssh2_exec($ssh2, $cmd);
stream_set_blocking($stdio, true);
$stdout = stream_get_contents($stdio);
$stderr = stream_get_contents(ssh2_fetch_stream($stdio, SSH2_STREAM_STDERR));
----
Server IP: 69.147.83.197
Probable Submitter: 186.48.223.227
----
Manual Page -- http://www.php.net/manual/en/function.ssh2-exec.php
Edit -- https://master.php.net/note/edit/107325
Del: integrated -- https://master.php.net/note/delete/107325/integrated
Del: useless -- https://master.php.net/note/delete/107325/useless
Del: bad code -- https://master.php.net/note/delete/107325/bad+code
Del: spam -- https://master.php.net/note/delete/107325/spam
Del: non-english -- https://master.php.net/note/delete/107325/non-english
Del: in docs -- https://master.php.net/note/delete/107325/in+docs
Del: other reasons-- https://master.php.net/note/delete/107325
Reject -- https://master.php.net/note/reject/107325
Search -- https://master.php.net/manage/user-notes.php