Hello
I am facing an issue with cURL in my PHP application. When trying to make a secure HTTPS request, I am getting the following error:
cURL error: SSL certificate problem: unable to get local issuer certificate
Details:
Code Snippet
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.example.com/data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
}
curl_close($ch);
I haveverified that the SSL certificate is valid and not expired. Downloaded and updated the cacert.pem file from cURL's website and configured php.ini:
curl.cainfo = "/path/to/cacert.pem"
Checked the server's openssl version and it is up-to-date.
How can I resolve the "unable to get local issuer certificate" error in cURL?
Are there any additional configurations I need to make in php.ini or my server environment?
Any suggestions on how to solve this SSL issue would be greatly appreciated.
Thank you in advance for your help!
Best regards,
nolanmaris
I am facing an issue with cURL in my PHP application. When trying to make a secure HTTPS request, I am getting the following error:
cURL error: SSL certificate problem: unable to get local issuer certificate
Details:
- Server Environment: Apache on Ubuntu 20.04
- PHP Version: 7.4
- cURL Version: 7.68.0
Code Snippet
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.example.com/data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
}
curl_close($ch);
I haveverified that the SSL certificate is valid and not expired. Downloaded and updated the cacert.pem file from cURL's website and configured php.ini:
curl.cainfo = "/path/to/cacert.pem"
Checked the server's openssl version and it is up-to-date.
How can I resolve the "unable to get local issuer certificate" error in cURL?
Are there any additional configurations I need to make in php.ini or my server environment?
Any suggestions on how to solve this SSL issue would be greatly appreciated.
Thank you in advance for your help!
Best regards,
nolanmaris
Kommentar