Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

Currently, I am doing a project on laravel5.

I use socialize for Facebook authentication,But I got cURL error Mentioned below.

 RequestException in CurlFactory.php line 162:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I have searched on internet and done following changes but didn't helped

  • downloaded cart.pem file
  • set path "curl.cainfo ="C:\xampp\cacert.pem"
  • also uncomment "extension=php_curl.dll"

My code of in controller

public function fb()  
{
    return Socialize::with('facebook')->redirect();
}
public function cb()    //callback for facebook
{
    $user = Socialize::with('facebook')->user();
    var_dump($user);
}
like image 201
Nilesh Avatar asked Jun 22 '15 08:06

Nilesh


People also ask

What is a curl Error 60?

Error “curl: (60) SSL certificate problem: unable to get local issuer certificate” can be seen when the SSL certificate on the server is not verified or properly configured.


2 Answers

While on local-host with Laravel you can easily bypass cURL error.

navigate to Client.php file (vendor\guzzlehttp\guzzle\src\Client.php)

Change "verify" to false

$defaults = [
        'allow_redirects' => RedirectMiddleware::$defaultSettings,
        'http_errors'     => true,
        'decode_content'  => true,
        'verify'          => false,
        'cookies'         => false
    ];
like image 141
Olufemi Ayodele Avatar answered Sep 23 '22 16:09

Olufemi Ayodele


For anyone pulling their hair out saying "I'VE DOWNLOADED A PRISTINE cacert.pem FILE, PUT IT IN THE CORRECT LOCATION, SET curl.cainfo CORRECTLY, AND RESTARTED MY APACHE SERVER BUT IT JUST DOESN'T WORK!?!?"... If you're using php-fpm then service apache2 restart and service apache2 reload will not update the reference and you'll continue to get error 60. If you intentionally point curl.cainfo to a bad path, you will not get the expected error 77 (first clue).

To restart php-fpm and update that reference (without rebooting the whole server), use service php-fpm restart or service php5-fpm restart or service php7-fpm restart or service php7.0-fpm restart, etc, depending on your php version. Hope this helps save someone time.

like image 45
Matt Rabe Avatar answered Sep 19 '22 16:09

Matt Rabe