From: pablo at bng5 dot net
Operating system: Ubuntu 8.10/9.04
PHP version: 5.2.11
PHP Bug Type: Apache2 related
Bug description: SSL Success, Failed to enable crypto
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 bug report at http://bugs.php.net/?id=50192&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50192&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50192&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50192&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50192&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50192&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50192&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50192&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50192&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50192&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50192&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50192&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50192&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50192&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50192&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50192&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50192&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50192&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50192&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50192&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50192&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50192&r=mysqlcfg