|Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK when implementing Facebook Connect|
|Written by Dicky|
|Wednesday, 08 September 2010 12:41|
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:
and immediately following it, add:
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.
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:
Otherwise you will need to do the following for every cURL resource:
curl_setopt ($ch, CURLOPT_CAINFO, "PATH_TO/cacert.pem");