2

I keep getting this same error. I just installed the SSL and no luck. I have checked out all the other posts but none of the solutions seemed to work for me.

Does anyone know what should I be doing ?

Fatal error: Uncaught CurlException: 77: error setting certificate verify locations: CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none thrown in /home/acmesoft/public_html/Oddsmaker/php_sdk/base_facebook.php on line 977

if ($result === false) {
  $e = new FacebookApiException(array(
    'error_code' => curl_errno($ch),
    'error' => array(
    'message' => curl_error($ch),
    'type' => 'CurlException',
    ),
  ));
  curl_close($ch);
  throw $e;
}
curl_close($ch);
return $result;
Xavi López
  • 27,550
  • 11
  • 97
  • 161
Pete D'Amelio
  • 23
  • 1
  • 1
  • 3
  • 2
    Looks duplicate, try that: http://stackoverflow.com/questions/8994059/facebook-application-development-using-php-sdk –  Mar 01 '13 at 02:40

3 Answers3

12

Riyanto Wibowo's response is dangerous because you're essentially turning off SSL. Be wary of taking that route. From a comment on the php manual:

Please everyone, stop setting CURLOPT_SSL_VERIFYPEER to false or 0. If your PHP installation doesn't have an up-to-date CA root certificate bundle, download the one at the curl website and save it on your server:

http://curl.haxx.se/docs/caextract.html

Then set a path to it in your php.ini file, e.g. on Windows:

curl.cainfo=c:\php\cacert.pem

Turning off CURLOPT_SSL_VERIFYPEER allows man in the middle (MITM) attacks, which you don't want!

I would have posted this as a comment but I don't have enough reputation.

patriot
  • 203
  • 2
  • 6
  • Better to dangerously have the damn thing work, then not have it work. People having to do this crap to break through the functioning-resistance is the fault of curl.haxx.se (or whoever made it), not themselves. –  Mar 08 '18 at 05:10
11

I have the same error with you and this problem was solved, I just put this 2 lines

Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;

after your facebook apps definition

$facebook = new Facebook(array(
  'appId'  => 'xxx',
  'secret' => 'xxx',
  'cookie' => true,
  'perms' => 'publish_stream,read_stream,email',
  'domain' => 'example.com'
))
Kenster
  • 23,465
  • 21
  • 80
  • 106
Riyanto Wibowo
  • 364
  • 1
  • 6
  • 13
  • This appeared for newly downloaded facebook php sdk like todays date. i used a copy of a previous download may be like 4 months back and did not get such errors... anyway. your workaround worked well for me. – Jayapal Chandran May 24 '13 at 08:45
  • 3
    Be careful with this answer; see patriot's answer below. This a bad answer because it exposes your app to man-in-the-middle (MITM) attacks. – thebitguru Oct 25 '17 at 16:14
0

You just need to have fb_ca_chain_bundle.crt in the same folder as base_facebook.php. You can get it here: https://github.com/facebook/facebook-php-sdk/blob/master/src/fb_ca_chain_bundle.crt