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

Published 2 years ago by eddy1992

I am using 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)

My controller :

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Socialite;

class AccountController extends Controller
{
    public function facebook_redirect() 

    {
        return Socialite::with('facebook')->redirect();
    }

    public function facebook()
    {
         $user = Socialite::with('facebook')->user();
    }
}

please help Thank you :)

eddy1992

Does anybody know what could be the problem ? Please help :(

samsoft

@eddy1992 what version of guzzlehttp/guzzle are you using?

pixelpeter
bashy
bashy
2 years ago (1,091,610 XP)

What DNS are you using? If you're using local/router you could change it to use public DNS like Google, Level3 etc http://pcsupport.about.com/od/tipstricks/a/free-public-dns-servers.htm

khaledSMQ

i solve it by remove the guzzlehttp/guzzle version 6 and install guzzlehttp/guzzle version 4

eddy1992

@samsoft I am using "laravel/socialite": "~2.0" in composer.json and yes @pixelpeter I am using windows

eddy1992

@bashy I use the option Obtain DNS server address automatically and yes I use local router.

bashy
bashy
2 years ago (1,091,610 XP)

Yeah you could try using a public DNS for developing. Which is why I use a VM so I can set this up separately!

If I use local DNS, it fails. If I use Google's, it works.

lalitesh

If someone is still looking for a solution, there is an easy fix:

Go to http://curl.haxx.se/ca/cacert.pem and download the pem file and save in your php installation directory ( make sure while saving it retains the extension and not saved as a text file )

Now, open your php.ini file, scroll to the bottom and add the following line:

[cURL] 
curl.cainfo="D:\xampp\php\cacert.pem"

Replace D:\xampp\php\cacert.pem with the actual path.

Courtesy: http://stackoverflow.com/questions/17478283/paypal-access-ssl-certificate-unable-to-get-local-issuer-certificate

pbaldovi

Excelent!

sorcjc
sorcjc
1 year ago (2,665 XP)

I have download the caert.pem file and save it in C:\wamp\bin\php\php5.5.12, with the proper extension. Next I modified and uncomment the next line:

curl.cainfo = "c:/wamp/bin/php/php5.5.12/cacert.pem"

But it still doesn't work.

EDIT: We have to modify C:\wamp\bin\apache\apache2.4.9\bin\ if we use wampserver (instead of C:\wamp\bin\php\php5.5.12\).

wmhilton

(Using XAMPP version 7.0.9 on Windows 10.) After 50 minutes of searching and trying things, it was a single line fix:

Edit C:\xampp\php\php.ini and add the line:

curl.cainfo = "C:/xampp/apache/bin/curl-ca-bundle.crt"

Oddly I didn't even have to update curl-ca-bundle.crt to a new version. Just needed that setting set.

Edit: AND restart Apache! :smiley:

HebaShop

I have just signed for this forum just to commend @wmhilton . I have searched for the solution for this problem for days and yours was the best. Thank you boss! Saved me hours

georgeos

In case someone is using Wamp server, the right file is located in: "C:\wamp\bin\apache\apache\bin\php.ini"

razikallayi

I tried it without a php artisan serve. Loaded the file directly from my wamp/www folder and it works fine

Please sign in or create an account to participate in this conversation.