关于php:2022818-cURL-error-60-SSL-certificate-problem

cURL error 60: SSL certificate problem: unable to get local issuer certificate

一、前言

明天在批改接手的企业微信音讯推送需要的时候,业务逻辑都理清了,但就是收不到推送。发送音讯的包用的是 overtrue 大佬的 easyWeChat,一开始想着是怎么实现音讯推送的,然而前面认真想想,这个包必定是通过大家的测验的,必定不是包的问题。所以就回到了发送音讯的代码上:

...
try{
    // 音讯推送...
}catch(\Exception $exception){
    Log::error('企业微信发送音讯谬误: ' ...);
}
...

如果发送失败,就会把抛出异样的谬误音讯写到日志中。

查看日志,音讯推送的报错如下:

企业微信发送音讯谬误: 
cURL error 60: SSL certificate problem: unable to get local issuer certificate 
(see https://curl.haxx.se/libcurl/c/libcurl-errors.html) 
for https://qyapi.weixin.qq.com/cgi-bin/...

查资料后得悉,这个谬误是因为没有配置信赖的服务器HTTPS验证

CURLE_PEER_FAILED_VERIFICATION (60)

The remote server’s SSL certificate or SSH md5 fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51.

二、解决办法

参考《解决cURL error 60: SSL certificate problem: unable to get local issuer certificate问题》

参考资料:

  1. 解决cURL error 60: SSL certificate problem: unable to get local issuer certificate问题|☆☆☆☆
  2. cURL error 60: SSL certificate problem: unable to get local issuer certificate|☆☆☆
  3. libcurl error codes|☆☆☆

注:五角星代表权重。

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理