我正在尝试安全地连接到此服务器bch.curalle.ovh
端口50002
我有来自letsencrypt的证书,该证书位于/var/www/mywebsite/fullchain.pem
我的代码:
$context = stream_context_create([ 'ssl' => [
'verify_peer' => true,
'verify_peer_name' => true,
'cafile' => '/var/www/mywebsite/fullchain.pem',
]
]);
$connection = stream_socket_client("ssl://bch.curalle.ovh:50002" , $errorn , $errorstr , 5 , STREAM_CLIENT_CONNECT , $context);
错误回复:
SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
我已将证书更改为CURL提供的证书但错误相同。
答案 0 :(得分:1)
导致此问题的原因如下:
我已经通过安装ntpdate并在ubuntu上运行ntpdate ntp.ubuntu.com
来修复它