|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-11 23:51 UTC] jbrady at sbccd dot cc dot ca dot us
[2008-07-15 18:28 UTC] news dot francoisxavier at free dot fr
[2009-01-08 04:40 UTC] steven at salvania dot be
[2009-02-08 10:28 UTC] mikesul@php.net
[2010-04-07 03:13 UTC] silvia dot cernuda at gmail dot com
[2015-01-05 14:45 UTC] slegersjohn at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
Description: ------------ PHP 5.2.0 final release 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 ---------------