Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mirkomen77's avatar

Google Sign in using Socialite give cURL error 51

Hi All,

on a fresh installation of Laravel 5.4 and Socialite package, I get this error when trying to log in via Google

cURL error 51: SSL: certificate verification failed (result: 5) (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Happens when hitting this controller:


/**
     * Handle Google Sign In redirection
     */
    public function handleGoogle()
    {
        $user = Socialite::driver('google')->user();

       // dd($user);
    }

Any suggestions?

0 likes
5 replies
jbloomstrom's avatar

You can try getting the latest ca-cert bundle

cd ~/.ssh
sudo wget http://curl.haxx.se/ca/cacert.pem
export CURL_CA_BUNDLE=~/.ssh/cacert.pem

Also check your php.ini settings and make sure your php is set to use the latest CA bundle.

mirkomen77's avatar

Thanks, I tried that, still not working.

I restarted Apache and my machine, still no luck

I have this in my php.ini


[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = "~/.ssh/cacert.pem"

jbloomstrom's avatar

I don't think php can expand paths containing "~".

Maybe try

//php.ini
[curl]
curl.cainfo = "/full/path/to/cacert.pem"

I would also copy cacert.pem to a folder you know the Apache user has read permissions on.

mirkomen77's avatar

Well, after upgrading to Sierra that problem is solved...

Please or to participate in this conversation.