note 128909 added to function.ssh2-exec
| From: | mlocati at gmail dot com | Date: | Thu, 21 Sep 2023 15:21:43 +0000 |
| Subject: | note 128909 added to function.ssh2-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220868@lists.php.net to get a copy of this message | ||
Since version 0.13 of the SSH2 extension, it's possible to retrieve the command exit status
with stream_get_meta_data().
For example:
<?php
$channel = ssh2_exec($connection, $command);
$metadata = stream_get_meta_data($channel);
$exitCode = $metadata['exit_status'];
?>
Retrieving the exit code is very helpful, since usually, commands return 0 in case of success, and
other values in case of errors.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 95.227.74.73)
----
Manual Page -- https://php.net/manual/en/function.ssh2-exec.php
Edit -- https://main.php.net/note/edit/128909
Del: integrated -- https://main.php.net/note/delete/128909/integrated
Del: useless -- https://main.php.net/note/delete/128909/useless
Del: bad code -- https://main.php.net/note/delete/128909/bad+code
Del: spam -- https://main.php.net/note/delete/128909/spam
Del: non-english -- https://main.php.net/note/delete/128909/non-english
Del: in docs -- https://main.php.net/note/delete/128909/in+docs
Del: other reasons-- https://main.php.net/note/delete/128909
Reject -- https://main.php.net/note/reject/128909
Search -- https://main.php.net/manage/user-notes.php