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|☆☆☆

注:五角星代表权重。


Moonshadow2333
28 声望0 粉丝

征途漫漫