Pete D'Amelio
Pete D'Amelio

Reputation: 23

Uncaught CurlException: 77 : error setting certificate verify locations

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;

Upvotes: 2

Views: 12615

Answers (3)

Riyanto Wibowo
Riyanto Wibowo

Reputation: 364

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'
))

Upvotes: 11

patriot
patriot

Reputation: 203

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.

Upvotes: 12

Vikram Srivastava
Vikram Srivastava

Reputation: 39

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

Upvotes: 0

Related Questions