12
votes

I'm trying to run the example that comes with Facebook's PHP SDK, however I'm getting the following error:

Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed thrown in C:\wamp\www\fb\src\facebook.php on line 614

Any ideas what I'm doing wrong?

6

6 Answers

24
votes

The problem is cURL has not been configured to trust the server's HTTPS certificate, you can fix that by adding this line of code:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
4
votes

I just had the same problem, and disabling peer verification is not acceptable in my case. I updated the fa_ca_chain_bundle.crt file (from facebook's gitbub) and it works now.

Regards, Marek

3
votes

Raymond Ho answer of adding this line of code works fine:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Just make sure for the new facebook sdk to have it in the "Facebook_base" file before:

$result = curl_exec($ch);

Thanks.

2
votes

find this line

and immediately following it, add:

$opts[CURLOPT_SSL_VERIFYPEER] = false;

1
votes

other way is add this line, is the same suggestion as the others replies, but in one line, make sure to include the Facebook SDK first

Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
1
votes

I just had the same problem, and you just need to update the crt file that you can find here https://raw.githubusercontent.com/facebook/facebook-php-sdk/master/src/fb_ca_chain_bundle.crt

the crt file is inside the same folder of the file that gives you that error