PHP CURL CURLOPT_SSL_VERIFYPEER ignored

前端 未结 2 441
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 04:35

For some reason I am unable to use CURL with HTTPS. Everything was working fine untill I ran upgrade of curl libraries. Now I am experiencing this response when trying to pe

相关标签:
2条回答
  • 2020-11-28 04:52

    According to documentation: to verify host or peer certificate you need to specify alternate certificates with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option.

    Also look at CURLOPT_SSL_VERIFYHOST:

    • 1 to check the existence of a common name in the SSL peer certificate.
    • 2 to check the existence of a common name and also verify that it matches the hostname provided.

    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    
    0 讨论(0)
  • 2020-11-28 04:54

    We had the same problem on a CentOS7 machine. Disabling the VERIFYHOST VERIFYPEER did not solve the problem, we did not have the cURL error anymore but the response still was invalid. Doing a wget to the same link as the cURL was doing also resulted in a certificate error.

    -> Our solution also was to reboot the VPS, this solved it and we were able to complete the request again.

    For us this seemed to be a memory corruption problem. Rebooting the VPS reloaded the libary in the memory again and now it works. So if the above solution from @clover does not work try to reboot your machine.

    0 讨论(0)
提交回复
热议问题