Edit report at https://bugs.php.net/bug.php?id=50953&edit=1
ID: 50953 Comment by: sp01 at 6vcommerce dot ca Reported by: tony at marston-home dot demon dot co dot uk Summary: fsockopen will not work on 'localhost' Status: Closed Type: Bug Package: Sockets related Operating System: Windows XP PHP Version: 5.2.12 Assigned To: pajoye Block user comment: N Private report: N New Comment: I think this issue still exists in 5.3.x, including the latest 5.3.17. I had a VPS with Debian 6.0.6 and PHP 5.3.17-1~dotdeb.0 and was unable to connect to smtp.gmail.com via fsockopen until I disabled (sysctl net.ipv6.conf.all.disable_ipv6=1) IPv6 on the VPS. A strace of the fsockopen call while IPv6 was enabled showed that an attempt to connect via IPv6 was made and timed out, followed by no attempt to connect via IPv4. Additionally, I had no problem connecting to smtp.gmail.com via openssl s_client so the issue appears isolated to fsockopen. I've also noticed at least one other claim of this bug in 5.3.x (ref: http://drupal.org/node/805834#comment-6260564) Previous Comments: ------------------------------------------------------------------------ [2010-10-02 20:32:21] cataphr...@php.net Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&revision=303958 Log: - Fixed a small mistake in the fix for bug #50953 that made connection timeouts not be detected as such. ------------------------------------------------------------------------ [2010-09-07 11:48:14] paj...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2010-09-07 11:47:39] paj...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revision&revision=303129 Log: - fix bug #50953, socket will not connect to IPv4 address when the host has both ipv4 and ipv6 addresses ------------------------------------------------------------------------ [2010-09-07 10:54:49] cataphr...@php.net This is indeed a bug. The problem is that PHP doesn't detect a connection was actively refused and instead times out on it. The scenario where the address has both ipv4 and ipv6 addresses, the service is only listening on ipv4 and ipv6 has precedence results in: a) trying ipv6 b) time out c) fail instead of a) trying ipv6 b) connection refused c) trying ipv4 d) success I've attached a patch that fixes the issue. ------------------------------------------------------------------------ [2010-09-07 10:26:47] cataphr...@php.net The following patch has been added/updated: Patch Name: connect_fix_win32 Revision: 1283848007 URL: http://bugs.php.net/patch-display.php?bug=50953&patch=connect_fix_win32&revision=1283848007 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=50953 -- Edit this bug report at https://bugs.php.net/bug.php?id=50953&edit=1