|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-17 09:27 UTC] jani@php.net
[2009-11-25 01:00 UTC] php-bugs at lists dot php dot net
[2009-12-13 18:22 UTC] felipe@php.net
[2009-12-21 01:00 UTC] php-bugs at lists dot php dot net
[2011-07-13 12:32 UTC] daniel dot meister at datahouse dot ch
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
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