/** * "Proper" disconnect */ public function __destruct() { if ($this->ssh instanceof SSH2) { $this->ssh->disconnect(); } if ($this->sftp instanceof SFTP) { $this->sftp->disconnect(); } }