Laravel 5 Socialite - cURL error 77: error setting

2019-01-17 11:41发布

问题:

I am using socialite in Laravel 5 to setup facebook login. I followed the instructions carefully until I got stuck with the following error

cURL error 60: SSL certificate problem: unable to get local issuer certificate

so I found the this answer to fix it which indeed passed but then I got this error

cURL error 77: error setting certificate verify locations:
CAfile: /Applications/XAMPP/xamppfiles/cacert.pem
CApath: none

Any ideas what's the cause of this error?! and how to fix it?!

回答1:

I got stuck on this problem as well. It turned out that I had the path to my certificate set incorrectly in my php.ini file. Forgot the .txt extension.

What I had:

curl.cainfo = "C:\xampp\php\cacert.pem"

What I changed it to:

curl.cainfo = "C:\xampp\php\cacert.pem.txt"

Hope this helps.



回答2:

Add cacert.pem file from https://curl.haxx.se/ca/cacert.pem in c:\xampp\php\cacert.pem

Change setting in php.ini file:

curl.cainfo = "C:\xampp\php\cacert.pem



回答3:

  1. Save this certificate (https://curl.haxx.se/ca/cacert.pem) as cacert.pem.txt in C:\xampp\php
  2. Add to php.ini:

    curl.cainfo = "C:\xampp\php\cacert.pem.txt"
    
  3. Don't forget to restart XAMPP (it won't work until it restarts)

Then it works fine!



回答4:

Checkout double quote on php.ini file: if you copied and past from the Web maybe you got wrong double quote:

”C:\xampp\php\cacert.pem.txt”

instead of

"C:\xampp\php\cacert.pem.txt"



回答5:

You need to replace the existing certificate with the other one here. After that:

  • Extract and add it to xampp\php\ext
  • Open xampp\php\php.ini
  • Add this line curl.cainfo='location from the first step' to the end of the file.
  • Restart and it should be working now.

This is the source link.



回答6:

I read every thread I could find and this one provided the missing piece.

Background: I encountered this issue will trying to get Drupal 8 to check for available updates on a fresh development environment (wamp based).

  1. Get a copy of the Certificate data from Mozilla, it can be found here: https://curl.haxx.se/ca/cacert.pem If you want to know more about what this is read this: https://serverfault.com/questions/241046/what-is-the-cacert-pem-and-for-what-to-use-that
  2. Save the file as "cacert.pem.txt" not as "cacert.pem" This was the missing piece, thanks LyleK!. I have no clue why but you must have the .txt extension on the end or it does not work.
  3. Explicitly add the path to the location of the "cacert.pem.txt" file to your php.ini

Example:

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = "C:\wamp\custom\cacert.pem.txt"

If you are using a wamp stack restart it. You should be good to go.



回答7:

First, you need to download your "curl.cainfo" file then you need to locate it to C:\xampp\php\cacert.pem.txt.

Second, you need to open your php.ini file in Xampp and copy this =>

curl.cainfo = C:\xampp\php\cacert.pem.txt anywhere you want.

Third please restart your Apache Server refresh your localhost page and that should work fine.



回答8:

this worked for me

curl.cainfo = "C:\xampp\php\cacert.pem.txt"

hope it helps some one :)



回答9:

If anyone is running Windows with Plesk and they get this error.

You must ensure that the curl.cainfo path is inside the Plesk PHP directory otherwise you will get the error above even with the fix.

curl.cainfo = "C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\extras\ssl\cacert.pem.txt"

Fixed for me. Hope this helps someone, someday, somewhere.



回答10:

For windows

I had same problem after i updated php on window 2008. Suddenly all my php codes stopped working. What i did, i opned php.ini then i found a line

;curl.cainfo =

and i changed to

curl.cainfo = "C:\Program Files (x86)\PHP\v7.0\cacert.pem" (remember to remove ; before curl.cainfo)

and everything went to normal. What you need is to download a cert file cert.pem and place it anywhere on your server and change the line as i did in php.ini



回答11:

I had the same issue and i tried every solution mentioned here and on other posts but none of them worked. I tried
1) Setting proper file rights ( didn't work )
2) Changing file extension ( didn't work)


then i moved the cacert.pem file inside php/ directory in xampp and restarted it, it worked. Hope it helps someone.



回答12:

i had the same problem. you have to open the file .pem or pem.txt with a simple editor (bloc-note) and past the (https://curl.haxx.se/ca/cacert.pem) in your file. you have to reload apache.



回答13:

I've tried @mahesh-singh-chouhan, @omarsafwany, @LyleK solutions. but get same error repeatedly.

After that, I update php.ini file without double quotes & with .pem extension & I'm succeed to get desired result with below code.

curl.cainfo=E:\Xampp-5.6.3\php\ext\cacert.pem

I've also attached Screenshot.

Please first try above users suggestions, If failed also use this.

Thanks for solutions It creates way for me @mahesh-singh-chouhan, @omarsafwany, @LyleK [![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/3Pgkp.jpg


回答14:

It seems you forgot to add quote for the file path. I was got the same error (77), that was because i forgot to add quotes. I solved the problem by adding that. ex: "C:\AppServ\php\cacert.pem"



回答15:

If it is related to git
git config --global http.sslverify "false" will solve the problem