|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47791 Error creating secure socket cnnection
Submitted: 2009-03-26 15:49 UTC Modified: 2009-03-26 22:28 UTC
From: abuse at byethost dot org Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.2.9 OS: Debian
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: abuse at byethost dot org
New email:
PHP Version: OS:


 [2009-03-26 15:49 UTC] abuse at byethost dot org
Creating a SSL connection using fsocket yields an error

My operating system is Debian , and configure line is as follows : 

 './configure' '--prefix=/usr/phpapache2' '--with-apxs2=/usr/local/apache2/bin/apxs' '--disable-cgi' '--disable-cli' '--with-config-file-path=/etc/php4/apache' '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--disable-static' '--with-layout=GNU' '--with-pear=/usr/share/php' '--enable-calendar' '--with-bz2' '--disable-ctype' '--with-iconv' '--enable-exif' '--enable-ftp' '--with-gettext' '--disable-ipv6' '--disable-wddx' '--disable-posix' '--with-expat-dir=/usr' '--with-zlib' '--without-pgsql' '--enable-zip=/usr' '--with-exec-dir=/usr/lib/php4/libexec' '--without-sybase-ct' '--with-mysql=/usr' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-ttf=shared,/usr' '--with-t1lib' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-sqlite' '--with-mysqli' '--with-xsl' '--enable-ctype' '--with-pdo-mysql' '--with-xmlrpc' '--without-pdo-sqlite' '--enable-mbstring' '--disable-inifile' '--disable-flatfile' '--with-openssl' '--enable-sockets'

running php 5.2.9 

Reproduce code:
When trying the following code : 

$fp = fsockopen("ssl://" , 443, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host:\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);

Expected result:
see the webpage collected 

Actual result:
Warning: fsockopen() [function.fsockopen]: SSL: connection timeout in /path/to/file/p.php on line 2

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in /path/to/file/p.php on line 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-26 22:28 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The error is self explanatory and indicates a server issue rather than PHP.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 21:03:35 2022 UTC