|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-12 09:23 UTC] mplourde at digicom dot ca
[2012-02-24 13:27 UTC] bart dot de dot lange at live dot nl
[2012-06-13 20:55 UTC] langemeijer@php.net
-Status: Open
+Status: Feedback
[2012-06-13 20:55 UTC] langemeijer@php.net
[2012-10-06 09:22 UTC] langemeijer@php.net
-Status: Feedback
+Status: No Feedback
[2012-10-06 09:22 UTC] langemeijer@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ /* Part of phpinfo() */ Registered PHP Streams => php, file, http, ftp, tftp, telnet, dict, ldap, https, ftps, compress.zlib, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp ssh2 libssh2 version => 0.12 banner => SSH-2.0-libssh2_0.12 remote forwarding => enabled hostbased auth => enabled polling support => enabled publickey subsystem => enabled /* End Part of phpinfo() */ I try ssh connection using php script to do some remote command and retrieve result of it. I got many connection on differents servers to do in a endless loop (act like a daemon), so i have to disconnect everytime the connection is useless or at the 2nd time loop there will be duplicate connection and at the 3rd time loop ... And someday (in fact it take some minute) sshd will refuse connection. Reproduce code: --------------- if($con_ssh = ssh_connect("x.x.x.x"))exit(1); if(!ssh_auth_pubkey_file($con_ssh,'root','/root/.ssh/id_dsa.pub','/root/.ssh/id_dsa', ''))exit(1); $stdio = ssh2_shell($con_ssh,"xterm"); $stderr = ssh2_fetch_stream($stdio,SSH2_STREAM_STDERR); fwrite($stdio,"ls\n"); fflush($stdio); sleep(10); fclose($stderr); fclose($stdio); sleep(10); unset($con_ssh); sleep(10); Expected result: ---------------- When open and another xterm console on the remote server, "who" command must show the shell is on while the first sleep is on and the "ps" command must show one more sshd process. After closing both stream (while the second sleep hold on), shell is off but there is still one more sshd process. After unset the ssh session ressource ($con_ssh), the "one more sshd process" have disapear. Connection must ended when stream are close and ssh2 session ressource is unset. Actual result: -------------- Connection is keep alive until i force the end of script (daemon), this result in incapacity to connect to remote server since sshd refuse connection (too many). When i comment all line using stderr and ssh2_fetch_stream, the connection end normally as describe in the expected result.