|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-08-30 03:11 UTC] daniel dot buschke at nextiraone dot de
Description: ------------ Hi, in PHP 5.1.3 I had follwing problem: When trying to connect to a host via ssh2_connect and socksify (see dante) I got the error that ssh2_connect is unable to the host. strace shows that the socket returned with "EINPROGRESS (Operation now in progress)" witch is not a "real" error. As I tried to find the problem I recognized that fsockopen has the same problem and that the problem is in some php functions (which are also used by ssh2). BUT PHP Won't fix that (see http://bugs.php.net/bug.php?id=42467 ). Instead they told me that fsockopen is using "quick'n'dirty socket stuff". Or with other words: they told me that ssh2 is using the "quick'n'dirty socket stuff". BTW: socket_create and socket_connect works fine with socksify. This is not a problem of socksify! in PHP 5.2-200708290830 (from CVS) I just got a "Segmentation fault" but strace shows that the socket still returns with "Operation now in progress" -------- SOME OTHER INFORMATIONS -------- # php -i |fgrep configure Configure Command => './configure' '--with-zlib' '--with-mysql' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-track-vars' '--enable-ftp' '--with-snmp' '--enable-pcntl' '--enable-sockets' '--with-config-file-path=/www/conf' '--with-mime-magic' '--with-ldap' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-freetype-dir=/usr/local/lib' '--with-png-dir=/usr/lib' '--with-libxml-dir=/usr/lib' '--enable-mbstring' '--with-sybase-ct=/usr/local/freetds' webserver_dev conf # php -v PHP 5.2.4RC4-dev (cli) (built: Aug 29 2007 11:28:47) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies I will try to give you an gdb backtrace of the "segmentation fault". Reproduce code: --------------- <?php $ssh_con = ssh2_connect('84.38.64.78'); $fingerprint = ssh2_fingerprint($ssh_con, SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX); echo $fingerprint ?> But please use your own SSH server! My firewall may drop your requests ;-) Expected result: ---------------- successfully connect to the ssh server Actual result: -------------- socket returns with "Operation now in progress" and ssh2_connect returns FALSE and an PHP Warning that connect is not possible PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 17:00:02 2025 UTC |
Ah, ok, the "Segmentation fault" problem is "solved" after completly reinstall php and ssh2... But the connection problem still exists: webserver_dev sandbox # socksify php -f ssh.php PHP Warning: ssh2_connect(): Unable to connect to 84.38.64.78 on port 22 in /www/vhosts/dev/sandbox/ssh.php on line 3 PHP Warning: ssh2_connect(): Unable to connect to 84.38.64.78 in /www/vhosts/dev/sandbox/ssh.php on line 3 PHP Warning: ssh2_fingerprint() expects parameter 1 to be resource, boolean given in /www/vhosts/dev/sandbox/ssh.php on line 4 # strace -enetwork socksify php -f ssh.php [...] connect(6, {sa_family=AF_INET, sin_port=htons(1080), sin_addr=inet_addr("10.248.2.193")}, 16) = -1 EINPROGRESS (Operation now in progress) getsockname(3, {sa_family=AF_INET, sin_port=htons(49360), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0 getsockname(3, {sa_family=AF_INET, sin_port=htons(49360), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0 sendmsg(4, {msg_name(0)=NULL, msg_iov(1)=[{"\3\0\0\0\1\231\361\267\0\0\0\0$\370\366\267\1\0\0\0\0\0"..., 3076}], msg_controllen=16, {cmsg_len=16, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {6}}, msg_flags=MSG_OOB|MSG_DONTROUTE|MSG_TRUNC|MSG_ERRQUEUE|MSG_DONTWAIT|MSG_CONFIRM|MSG_FIN|MSG_SYN|MSG_NOSIGNAL|0x20740000}, 0) = 3076 --- SIGCHLD (Child exited) @ 0 (0) --- getsockname(6, {sa_family=AF_INET, sin_port=htons(51812), sin_addr=inet_addr("10.138.137.15")}, [16]) = 0 getpeername(6, {sa_family=AF_INET, sin_port=htons(1080), sin_addr=inet_addr("10.248.2.193")}, [16]) = 0 getsockname(3, {sa_family=AF_INET, sin_port=htons(51812), sin_addr=inet_addr("10.138.137.15")}, [16]) = 0 getpeername(3, {sa_family=AF_INET, sin_port=htons(1080), sin_addr=inet_addr("10.248.2.193")}, [16]) = 0 --- SIGCHLD (Child exited) @ 0 (0) --- PHP Warning: ssh2_connect(): Unable to connect to 84.38.64.78 on port 22 in /www/vhosts/dev/sandbox/ssh.php on line 3 PHP Warning: ssh2_connect(): Unable to connect to 84.38.64.78 in /www/vhosts/dev/sandbox/ssh.php on line 3 PHP Warning: ssh2_fingerprint() expects parameter 1 to be resource, boolean given in /www/vhosts/dev/sandbox/ssh.php on line 4 Process 31871 detached