PHP 8.0.11 and PHP 5 The function fsockopen does not work now

323 views
Skip to first unread message

Игорь Васьков

unread,
Nov 9, 2021, 6:22:01 AM11/9/21
to Apache for OS/2
Hi Paul,

Please test this sample:
<?php
$rc=@fsockopen( "ssl://www.google.com", 80, $errno, $errstr, 60 );
echo "errno: $errno, $errstr, rc=$rc"
?>

My system returns:
>errno: 0, , rc=

Error only in encrypted connection (ssl://).
Previously, it worked on PHP 5. What has changed and when it stopped - I do not know.

Paul Smedley

unread,
Nov 10, 2021, 3:14:45 AM11/10/21
to apa...@googlegroups.com
Hi Igor,
I get the same running on Ubuntu server

Cheers,

Paul

Игорь Васьков

unread,
Nov 10, 2021, 6:27:32 AM11/10/21
to Apache for OS/2
Hi Paul,
 
In my example error. That's right.

<?php
$rc=@fsockopen( "ssl://www.google.com", 443, $errno, $errstr, 60 );

echo "errno: $errno, $errstr, rc=$rc"
?>

However, the socket does not open anyway and I have a suspicion that opensl does not work correctly.

среда, 10 ноября 2021 г. в 11:14:45 UTC+3, Paul Smedley:

Игорь Васьков

unread,
Nov 10, 2021, 10:04:11 AM11/10/21
to Apache for OS/2
The problem is solved. You must add to file php.ini string:
openssl.cafile=C:/etc/ssl/cacert.pem

cacert.pem download from:
http://curl.haxx.se/ca/cacert.pem
среда, 10 ноября 2021 г. в 11:14:45 UTC+3, Paul Smedley:
Hi Igor,
Reply all
Reply to author
Forward
0 new messages