Troubleshooting Ignored CURLOPT_SSL_VERIFYPEER in PHP CURL
Problem:
Users are encountering an issue where HTTPS requests using CURL raise a "Problem with the SSL CA cert" error, despite setting both CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST to false.
Causes and Solutions:
To successfully verify host or peer certificates using CURL, you need to specify alternate certificates with CURLOPT_CAINFO or a certificate directory with CURLOPT_CAPATH.
Additionally:
CURLOPT_SSL_VERIFYHOST:
Suggested Code:
To disable verification for host and peer:
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
To enable verification and specify a CA certificate file:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_CAINFO, "/path/to/cacert.pem");
Additional Notes:
Update:
After updating libraries and restarting the system, the issue may resolve itself.
The above is the detailed content of How to Resolve \'Problem with the SSL CA Cert\' Error in PHP CURL Despite Disabling Verification?. For more information, please follow other related articles on the PHP Chinese website!