Bug #50192 [Com]: SSL Success, Failed to enable crypto

From: Date: Wed, 13 Jul 2011 16:32:05 +0000
Subject: Bug #50192 [Com]: SSL Success, Failed to enable crypto
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161867@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50192&edit=1

 ID:                 50192
 Comment by:         daniel dot meister at datahouse dot ch
 Reported by:        pablo at bng5 dot net
 Summary:            SSL Success, Failed to enable crypto
 Status:             No Feedback
 Type:               Bug
 Package:            Apache2 related
 Operating System:   Ubuntu 8.10/9.04
 PHP Version:        5.2.6
 Block user comment: N
 Private report:     N

 New Comment:

Just in case somebody else finds this via Google:

I encountered this exact same problem today on a Debian Lenny with PHP 5.2.6: Starting the script
from the CLI interface worked perfectly; starting the same script via Apache produced the described
error.

It turned out to be a permission problem on "/dev/urandom" (rw-rw----, root:root) and not
a PHP bug!


Previous Comments:
------------------------------------------------------------------------
[2009-12-21 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2009-12-13 18:22:50] felipe@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

I cannot reproduce it.

------------------------------------------------------------------------
[2009-11-25 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2009-11-17 09:27:31] jani@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------
[2009-11-16 19:00:20] pablo at bng5 dot net

Description:
------------
Cannot open a secure socket with 'fsockopen' function.

My PHP Version is 5.2.6-3ubuntu4.2, I installed it from the Ubuntu repositories, this is the latest
PHP version I can get from there.

The same script works fine with PHP-CLI, but throws an error on Apache2 (same PHP installation).

Excuse my english.

Reproduce code:
---------------
<?php
$host = 'www.mozilla.com';
$port = 443;
$path = '/es-ES/';
$headers = 'GET '.$path.' HTTP/1.0
Host: '.$host.'

';
$fp = fsockopen("ssl://".$host, $port, $errno, $errstr, 30);
if($fp)
 {
  fwrite($fp, $headers);
  while($string = trim(fgets($fp, 4096)))
   {
    echo $string."\n";
   }
 }
?>


Expected result:
----------------
-- This is the actual result on PHP-CLI
-- PHP Version => 5.2.6-3ubuntu4.2
-- 
-- System => Linux wintermute 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24 UTC 2009 i686
-- Build Date => Aug 21 2009 19:12:00
-- Server API => Command Line Interface

HTTP/1.0 200 OK
Date: Mon, 16 Nov 2009 18:39:02 GMT
Expires: Mon, 16 Nov 2009 18:54:02 GMT
Cache-Control: max-age=900
Xontent-Length:
Connection: Close
Via: NS-CACHE-6.0:   4
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.1.6
Content-Type: text/html; charset=UTF-8


Actual result:
--------------
-- PHP Version => 5.2.6-3ubuntu4.2
-- 
-- System => Linux wintermute 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24 UTC 2009 i686
-- Build Date => Aug 21 2009 18:45:50
-- Server API => Apache 2.0 Handler 


Warning: fsockopen() [function.fsockopen]: SSL: Success in /home/user/public_html/fsockopen.php on
line 14

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in
/home/user/public_html/fsockopen.php on line 14

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.mozilla.com:443 (Unknown
error) in /home/user/public_html/fsockopen.php on line 14


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=50192&edit=1


Thread (4 messages)

« previous php.bugs (#161867) next »