Fopen (): SSL operation failed with code 1.

fopen (): SSL operation failed with code. OpenSSL Error messages:
error:140943FC:SSL routines:SSL3_READ_BYTES:sslv3 alert bad record mac

what is the problem, please? How to solve it? My operating environment is PHP7

Mar.30,2021

running environment

openssl version LibreSSL 2.2.7
php-v PHP 7.1.16 (cli)
<?php
var_dump(fopen('https://www.baidu.com/', 'r'));

there is no problem in executing the above command. It should be a higher version of the server ssl

try the following scenario

scenario 1: modify PHP configuration

modify openssl.cafile to default_cert_file
openssl.cafile=/private/etc/ssl/cert.pem

in openssl_get_cert_locations ()

Plan 2: upgrade native OpenSSL

Plan 3: use curl to call ssl check

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //,ssl
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // host

if none of these aspects are feasible, let's communicate again.

Menu