|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70199 fsockopen fails with IPv6
Submitted: 2015-08-06 04:32 UTC Modified: 2015-08-16 04:23 UTC
From: diogo at mgniers dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.4.43 OS: CentOS 6.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: diogo at mgniers dot com
New email:
PHP Version: OS:


 [2015-08-06 04:32 UTC] diogo at mgniers dot com
On a server with support for IPv4 and IPv6, whereas the target domains support both protocols, the fsockopen function only works with IPv4, causing timeout when try to connect via IPv6.

Test script:
$con = fsockopen('', 587, $errno, $errstr, 10);
if(empty($con)) echo "Not connected: ".$errno." - ".$errstr;
else echo "Connected!";

Expected result:

Actual result:
Not connected: 110 - Connection timed out


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-06 04:52 UTC]
-Status: Open +Status: Feedback
 [2015-08-06 04:52 UTC]
So you can connect to it, from the same server, to the same server and the same port, all over IPv6, using other applications (like telnet) but not with PHP?
 [2015-08-16 04:23 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 17:01:29 2024 UTC