Home Blog PHP Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK when implementing Facebook Connect
Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK when implementing Facebook Connect
PHP
Written by Dicky   
Wednesday, September 08 2010 12:41
AddThis Social Bookmark Button

I was creating a personal website based on PHP for my side project. I tinker around to integrate Facebook to my website. After doing some research, it can be done using Facebook Connect and their new Graph API.

Surprisingly, there are not much example out there since Graph API is pretty new and just released couple months ago. I did found a lot of examples using legacy API call and FQL. I finally found an article at thinkdiff.net explaining the usage of Graph API which uses Facebook PHP-SDK which further simplifies the process

During the development process, I was getting the following error: "Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK". The error seems to come from curl function in PHP but never really provide solution for Facebook SDK in particular. Until I found the following article by net tuts plus. The solution is actually pretty simple. You’ll have to open facebook.php, find the makeRequest() method, and, inside the function, find this line:

$opts = self::$CURL_OPTS; 

and immediately following it, add:

$opts[CURLOPT_SSL_VERIFYPEER] = false;

As the article mentioned, this will involved hacking the library since other solution has not been found. Anyway, that will solve the problem with the Curl SSL Cert problem.

[Update 4/7/14]

If you are dealing with personal information such as credit card number, I do not recommend the method above. Instead according to one of the answer in this article, you can do the following:

Since PHP 5.3.7 you could do:

  1. download http://curl.haxx.se/ca/cacert.pem and save it somewhere.
  2. update php.ini -- add curl.cainfo = "PATH_TO/cacert.pem"

Otherwise you will need to do the following for every cURL resource:

curl_setopt ($ch, CURLOPT_CAINFO, "PATH_TO/cacert.pem");