SunshinePHP 2020 CFP Started

ssh2_disconnect

(PECL ssh2 >= 1.0)

ssh2_disconnectClose a connection to a remote SSH server

説明

ssh2_disconnect ( resource $session ) : bool

Close a connection to a remote SSH server.

パラメータ

session

An SSH connection link identifier, obtained from a call to ssh2_connect().

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

参考

add a note add a note

User Contributed Notes 1 note

up
3
Cavallo
8 months ago
ssh2_disconnect(...) requires at least PHP 7 (as it requires PECL ssh2 >= 1.0, which the PECL documentation on https://pecl.php.net/package/ssh2 states: "ssh2 1.0 and above is PHP 7 only").

For PHP 5.x similar functionality, try setting the ssh2_connect session variable to null, or unsetting it completely - this should allow PHP's garbage collection close the connection.

Example:

$session=ssh2_connect(...); // open connection
// code here to use connection
$session = null; unset($session); // close connection
To Top