php Laravel 5 Socialite - cURL 错误 77:错误设置证书验证位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30240840/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 21:38:52  来源:igfitidea点击:

Laravel 5 Socialite - cURL error 77: error setting certificate verify locations

phpsslcurllaravel-5laravel-socialite

提问by omarsafwany

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

我在 Laravel 5 中使用社交名气来设置 Facebook 登录。我仔细按照说明进行操作,直到遇到以下错误

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

so I found the thisanswer 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?!

任何想法这个错误的原因是什么?!以及如何修复它?!

回答by LyleK

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.

我也被这个问题困住了。结果是我在 php.ini 文件中错误地设置了证书的路径。忘记了 .txt 扩展名。

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.

希望这可以帮助。

回答by Mahesh singh chouhan

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

Change setting in php.ini file:

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

https://curl.haxx.se/ca/cacert.pem在 c:\xampp\php\cacert.pem添加 cacert.pem 文件

更改 php.ini 文件中的设置:

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

回答by Samsul Arif Zulvian

My error is:

我的错误是:

cURL error 77: error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

cURL 错误 77:错误设置证书验证位置:CAfile:C:\xampp\apache\bin\curl-ca-bundle.crt CApath:none(参见 http://curl.haxx.se/libcurl/c/libcurl-errors .html)


This works well for me:


这对我很有效:

  1. Download the certificate from: https://curl.haxx.se/ca/cacert.pem
  2. Rename the cacert.pemfile into curl-ca-bundle.crt
  3. Copy the file into path/to/xampp/apache/bin
  4. Restart apache
  1. 从以下位置下载证书:https: //curl.haxx.se/ca/cacert.pem
  2. cacert.pem文件重命名为curl-ca-bundle.crt
  3. 将文件复制到path/to/xampp/apache/bin
  4. 重启apache

回答by Viktoria Brown

  1. Save this certificate (https://curl.haxx.se/ca/cacert.pem) as cacert.pem.txtin 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)
  1. 保存此证书(https://curl.haxx.se/ca/cacert.pem)为cacert.pem.txtC:\xampp\php
  2. 添加到php.ini

    curl.cainfo = "C:\xampp\php\cacert.pem.txt"
    
  3. 别忘了重启XAMPP(重启后才生效)

Then it works fine!

然后它工作正常!

回答by Nooovice Boooy

  1. Download from (https://curl.haxx.se/ca/cacert.pem)
  2. Change the name 'cacert.pem' to 'curl-ca-bundle.crt'
  3. In 'php.ini', remove';' in the following line: curl.cainfo="C:\xampp\apache\bin\curl-ca-bundle.crt"
  1. 从(https://curl.haxx.se/ca/cacert.pem)下载
  2. 将名称“ cacert.pem”更改为“ curl-ca-bundle.crt
  3. 在' php.ini'中,删除' ; ' 在以下行中: curl.cainfo="C:\xampp\apache\bin\curl-ca-bundle.crt"

That's worked for me.

这对我有用。

回答by messimalex

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

签出 php.ini 文件上的双引号:如果您从 Web 复制并粘贴过去,您可能会得到错误的双引号:

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

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

instead of

代替

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

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

回答by messimalex

For windows

窗户用

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

我在windows2008 上更新php后遇到了同样的问题。突然我所有的php代码都停止工作了。我做了什么,我打开了 php.ini 然后我找到了一行

;curl.cainfo =

;curl.cainfo =

and i changed to

我改为

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

curl.cainfo = "C:\Program Files (x86)\PHP\v7.0\cacert.pem"(记得在 curl.cainfo 之前删除 ;)

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

一切都正常了。您需要的是下载一个证书文件cert.pem并将其放置在您服务器上的任何位置并像我在 php.ini 中所做的那样更改该行

回答by Chason Arthur

I experienced some issues following instructions in regards to error 77.

按照有关错误 77 的说明,我遇到了一些问题。

On Windows 7, depending on your security settings - the file downloaded may be blocked. See screenshot:

在 Windows 7 上,根据您的安全设置 - 下载的文件可能会被阻止。看截图:

Windows 7 File Properties

Windows 7 文件属性

Once I unblocked the file and ensured proper user access rights, I also had to put the file in the following location:

一旦我取消阻止文件并确保正确的用户访问权限,我还必须将文件放在以下位置:

C:\xampp\apache\bin\cacert.pem.txt

C:\xampp\apache\bin\cacert.pem.txt

In addition to changing php.ini per the other posts on this issue.

除了根据有关此问题的其他帖子更改 php.ini 之外。

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

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

After completing the above steps, restarting Apache via the XAMPP Control Panel, the error was resolved.

完成上述步骤后,通过 XAMPP 控制面板重新启动 Apache,错误已解决。

回答by omarsafwany

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.
  • 提取并添加到 xampp\php\ext
  • 打开 xampp\php\php.ini
  • 将此行添加curl.cainfo='location from the first step'到文件末尾。
  • 重新启动,它现在应该可以工作了。

This is the sourcelink.

这是链接。

回答by Matthew Flynn

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

如果有人使用 Plesk 运行 Windows 并且他们收到此错误。

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 路径在 Plesk PHP 目录中,否则即使进行了修复,您也会收到上述错误。

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

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

为我固定。希望这可以帮助某人,有一天,在某个地方。