SSH connection - how do I disconnect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ubl_
Forum Newbie
Posts: 2
Joined: Mon Feb 23, 2009 8:06 am

SSH connection - how do I disconnect

Post by ubl_ »

Hi...

I am running PHP 5.2.8 on a windows machine.
I have added the extension "php_ssh2.dll" in order to make SSH connections from PHP.
I am running PHP as a script from a bat-file

I am able to connect, authenticate and execute commands through the SSH connection.

My problem is that I just don't know how to disconnect.

I tried using "unset($connection_ssh);" but when running "netstat -b" the connection is just waiting to be closed and will not be closed until the script is finished.

TCP dkmvpn7aaa:2262 192.168.117.11:ssh CLOSE_WAIT 6692
[php.exe]

If I don't use "unset" the connection is shown as established. (as expected)

How do I disconnect gracefully? (before the script ends)

Kind Regards
Ulrik
Post Reply