update page now
Longhorn PHP 2026 - Call For Papers

Voting

: zero minus zero?
(Example: nine)

The Note You're Voting On

mlocati at gmail dot com
2 years ago
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.

<< Back to user notes page

To Top