1
votes

After scouring the web, I really am at my wit's end. I know this question has been asked several times but none of the solutions solve my problem. I'd like to know if there are any other known reasons for curl error 60: "SSL certificate problem, verify that the CA cert is OK".

I have set CURLOPT_CAINFO to the pem file (also tried crt) and I have checked for insufficient permissions when trying to access pem file.

Here's the code by the way:

$url = 'https://example.com/';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 
curl_setopt($ch, CURLOPT_CAINFO, "/usr/local/apache2/htdocs/server/html/cacert.pem");

$response = curl_exec($ch);

...do something

curl_close($ch);
1

1 Answers

-1
votes

You can try this:-

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, **'https://example.com/'**);
// Set so curl_exec returns the result instead of outputting it.
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
// Get the response and close the channel.
$response = curl_exec($ch);