title: Through php how can I close an active ssh connection which is created by php ssh2_connect?
body: <p>I created an ssh connection using the following code.</p>
  
  <pre><code>    $connection = ssh2_connect($masterIp, 22);
  
      // authenticating the remote server connection with credentials
      ssh2_auth_password($connection, $user, $password);
  
      // secure ftp connection to create directory if not exist
      $sftp = ssh2_sftp($connection);
  </code></pre>
  
  <p>After completing the operations I need to close $connection, $sftp.
  How can I safely close the connections. Can I use unset() function?</p>