微信支付出现SSL certificate problem: unable to get local issuer certificate 解决方法

解决方法​

​一、 出错原因​

错误提示:SSL certificate problem: unable to get local issuer certificate

是在使用 curl 时出错,

意思是“SSL证书问题:无法获取本地颁发者证书”

​二、 解决办法​

有两种方式:

2-1) 检查你安装的证书路径

看下跟你 curl 中使用的是否一致

2-2) curl 取消 ssl 检查

如果你没有证书,

可以在 curl 相关代码中添加下面的代码
 

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

表示不检查 ssl

这种方式一般用于本地调试。

function curl_post1($url, $data = array(), $header = array(), $timeout = 80, $port = 80)
{
  $ch = curl_init ( $url );
  curl_setopt ( $ch, CURLOPT_POST, 1 );
  curl_setopt ( $ch, CURLOPT_HEADER, 0 );
  curl_setopt ( $ch, CURLOPT_FRESH_CONNECT, 1 );
  curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
  curl_setopt ( $ch, CURLOPT_FORBID_REUSE, 1 );
  curl_setopt ( $ch, CURLOPT_TIMEOUT, 30 );
  curl_setopt ( $ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json; charset=utf-8', 'Content-Length: ' . strlen ( $data ) ) );
  curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  //todo::增加改行
  $result = array();
  $result['result'] = curl_exec ( $ch );
  echo $functionName . " : Request Info : url: " . $url . " ,send data: " . $data . "  \n";
  echo $functionName . " : Respnse Info : " . $ret . "  \n";
  curl_close ( $ch );
  return $result;
}

你可能感兴趣的:(支付宝支付,phpcms,ssl,网络协议,微信支付)