|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19121 fsockopen("tls:// .... fails without reason.
Submitted: 2002-08-27 09:24 UTC Modified: 2002-08-27 18:38 UTC
From: mbabcock-php at fibrespeed dot net Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.2.2 OS: Linux 2.2.14
Private report: No CVE-ID: None
 [2002-08-27 09:24 UTC] mbabcock-php at fibrespeed dot net
I'm doing the following:

$fp = fsockopen("tls://", 2080, $errno, $errstr, 30);
if (!$fp) die ("Unable to connect: $errstr ($errno)");

... its giving me "Unable to connect:  (0)" every time ( is a valid Internet host I administer).  I'm running a "tcpdump -n port 2080" on the web server and there are no packets showing up at all.  There are no messages in /var/log/(messages|daemon|kern) or in the Apache error_log.    Any ideas?

Feel free to connect to  for information on my configuration.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-27 09:30 UTC]
Where did you read PHP supports tls:// ?

 [2002-08-27 09:32 UTC]
Never mind that, just lose the tls:// and you can connect fine, but of course you need to send encrypted packets yourself.
fsockopen opens a _socket_, not an URL.

User error -> bogus
 [2002-08-27 09:40 UTC]
The docs for fsockopen state:

As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host.

Your version of PHP is not PHP 4.3, so this won't work.
 [2002-08-27 18:21 UTC] mbabcock-php at fibrespeed dot net
Thanks for the version check comment; for some reason I assumed that since I'd updated to the latest publically available version of php the day before starting this test that the feature was available.  Obviously, that is not true.  

It would be nice if someone encouraged to read the fine manuals himself instead of immediately pulling a 'user error -> bogus'.
 [2002-08-27 18:38 UTC]
4.2.2 was a security-fix release.  No new features.  The tls:// stuff is a new feature in 4.3 as documented.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed May 25 14:04:06 2022 UTC