Through php how can I close an active ssh connection which is created by php ssh2_connect? -
i created ssh connection using following code.
$connection = ssh2_connect($masterip, 22); // authenticating remote server connection credentials ssh2_auth_password($connection, $user, $password); // secure ftp connection create directory if not exist $sftp = ssh2_sftp($connection);
after completing operations need close $connection, $sftp. how can safely close connections. can use unset() function?
yes, unset should suffice.
in php, when resources go out of scope or become unset, automatically closed (they should anyway, unless extension breaks standard php model).
(well, garage collected , closed when references resource destroyed)
Comments
Post a Comment