|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-29 14:51 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 12:00:01 2025 UTC |
Description: ------------ I have a page that refreshes every minute. In that page, I open an ssh session and obtain data. There is no way to close the ssh connection. On reload, php opens a new connection but does not terminate the last one or reuse the existing one. Running a NETSTAT command reveals numerous connections in the CLOSE_WAIT status after several minutes. Can a close SSH option be included? Reproduce code: --------------- <?php $connection = ssh2_connect('myserver',22); ssh2_auth_password($connection,'username','password'); $stream = ss2_exec($connection,'df -k',FALSE); stream_set_blocking($stream, TRUE); $output = fread($stream,4096); fclose($stream); echo $output; ?> Expected result: ---------------- Connection should show nothing Actual result: -------------- netstat -a shows ---------------- TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT TCP myweb:xxxx myserver:22 CLOSE_WAIT ---------------