php curl请求https 返回无结果|false|errno:35

时间:2022-06-10 21:06:22

1 SSL: certificate subject name 'WMSvc-GWAMSERVER02' does not match target host name

把curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

2 Curl error: SSL certificate problem: self signed certificate in certificat

这个是CURLOPT_SSL_VERIFYHOST 设为1引起,不同版本的libcurl对curl的CURLOPT_SSL_VERIFYHOST有影响

先在mac下,然后centos7下libcurl版本7.4以上 出现类似问题

解决方案

1

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

2 降低libcurl版本 到7.4下

wget http://curl.haxx.se/download/curl-7.38.0.tar.gz
tar xzvf curl-7.38.0.tar.gz
cd curl-7.38.0/
./configure
486 make && make install