PHP 卷曲错误代码 60

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21114371/
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 03:50:06  来源:igfitidea点击:

PHP cURL error code 60

phpcurl

提问by Ciaran

Whilst trying to setup a php environment on windows (using wamp) to use the Amazon PHP SDK, when i try to run a sample test I get the following error:

在尝试在 Windows 上设置 php 环境(使用 wamp)以使用 Amazon PHP SDK 时,当我尝试运行示例测试时,出现以下错误:

Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #10; cURL error: SSL certificate problem: unable to get local issuer certificate (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in C:\wamp\www\AWSSDKforPHP\lib\requestcore\requestcore.class.php on line 848

I have already added the following line to my php.ini

我已经将以下行添加到我的 php.ini

curl.cainfo = C:\Windows\ca-bundle.crt

which is the location of a certificate i created using this VBS script VBS-Script

这是我使用此 VBS 脚本VBS-Script创建的证书的位置

I have restarted my WAMP service also.

我也重新启动了我的 WAMP 服务。

PHP index curl reference

PHP索引卷曲参考

回答by Hüseyin BABAL

Use this certificate root certificate bundle:

使用此证书根证书包:

https://curl.haxx.se/ca/cacert.pem

https://curl.haxx.se/ca/cacert.pem

Copy this certificate bundle on your disk. And use this on php.ini

将此证书包复制到您的磁盘上。并使用它php.ini

curl.cainfo = "path_to_cert\cacert.pem"

回答by aimme

i fixed this by modifying php.inifile at C:\wamp\bin\apache\apache2.4.9\bin\

我通过修改php.ini文件来解决这个问题C:\wamp\bin\apache\apache2.4.9\bin\

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

first i was trying by modifying php.inifile at C:\wamp\bin\php\php5.5.12\and it didn't work.

首先我试图通过修改php.ini文件,C:\wamp\bin\php\php5.5.12\但它没有用。

hope this helps someone who is searching for the right php.inito modify

希望这可以帮助正在寻找php.ini修改权的人

回答by Anazul

php --ini

This will tell you exactly which php.ini file is being loaded, so you know which one to modify. I wasted a lot of time changing the wrong php.ini file because I had WAMP and XAMPP installed.

这将准确告诉您正在加载哪个 php.ini 文件,以便您知道要修改哪个文件。我浪费了很多时间更改错误的 php.ini 文件,因为我安装了 WAMP 和 XAMPP。

Also, don't forget to restart the WAMP server (or whatever you use) after changing php.ini.

另外,不要忘记在更改 php.ini 后重新启动 WAMP 服务器(或您使用的任何服务器)。

回答by pgkerr76

@Overflowh I tried the above answer also with no luck. I changed php version from 5.3.24 to 5.5.8 as this setting will only work in php 5.3.7 and above. I then found this http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issueI downloaded the cacert.pem from there and replaced the one I had download/made from curl.hxxx.se linked above and it all started working. I was trying to get paypal sandbox IPN to verify. Happy to say after the .pem swap all is ok using curl.cainfo setting in php.ini which still was not in 5.3.24.

@Overflowh 我也尝试了上面的答案,但没有运气。我将 php 版本从 5.3.24 更改为 5.5.8,因为此设置仅适用于 php 5.3.7 及更高版本。然后我找到了这个http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue我从那里下载了 cacert.pem 并替换了我从 curl.hxxx.se 下载/制作的那个上面链接,一切都开始工作了。我试图让贝宝沙盒 IPN 进行验证。很高兴地说,在 .pem 交换之后,使用 php.ini 中的 curl.cainfo 设置一切正常,但仍然不在 5.3.24 中。

回答by Gaurang Ghinaiya

@Hüseyin BABAL

@Hüseyin BABAL

I am getting error with above certificate but i try this certificate and its working.

我在使用上述证书时遇到错误,但我尝试使用此证书及其工作原理。

https://gist.github.com/VersatilityWerks/5719158/download

https://gist.github.com/VersatilityWerks/5719158/download

回答by Quang Nguyen Tri

First, we need download this certificate root certificate bundle:

首先,我们需要下载这个证书根证书包:

https://curl.haxx.se/ca/cacert.pem

https://curl.haxx.se/ca/cacert.pem

Move this file to somewhere such as to PHP folder in Wamp/Xampp folder.

将此文件移动到某个位置,例如 Wamp/Xampp 文件夹中的 PHP 文件夹。

Then edit your "php.ini" :

然后编辑你的“php.ini”:

curl.cainfo ="C:/path/to/your/cacert.pem"

curl.cainfo ="C:/path/to/your/cacert.pem"

and

openssl.cafile="C:/path/to/your/cacert.pem"

openssl.cafile="C:/path/to/your/cacert.pem"

IMPORTANT:

重要的:

Be sure that you open the "php.ini" file directly by your Window Explorer. (in my case: “C:\DevPrograms\wamp64\bin\php\php5.6.25\php.ini”).

确保您直接通过窗口资源管理器打开“php.ini”文件。(在我的例子中:“C:\DevPrograms\wamp64\bin\php\php5.6.25\php.ini”)。

Don't use the shortcut to "php.ini" in the Wamp/Xampp icon's menu in the System Tray. This shortcut didn't work in some cases I faced.

不要使用系统托盘中 Wamp/Xampp 图标菜单中“php.ini”的快捷方式。在我遇到的某些情况下,此快捷方式不起作用。

After saving "php.ini" you don't need to "Restart All Services" in Wamp icon or close/re-open CMD.

保存“php.ini”后,您无需在 Wamp 图标中“重新启动所有服务”或关闭/重新打开 CMD。

Try with " var_dump(openssl_get_cert_locations()); " and look at line : ["ini_cafile"]=> string(40) "C:/path/to/your/cacert.pem"

尝试使用“ var_dump(openssl_get_cert_locations()); ”并查看行: ["ini_cafile"]=> string(40) "C:/path/to/your/cacert.pem"

Done.

完毕。

回答by Arjun Londhey

The easiest solution to the problem is to add the below command in the field.

该问题的最简单解决方案是在字段中添加以下命令。

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);

Using this will not need to add any certificate or anything.

使用它不需要添加任何证书或任何东西。

回答by littlefox

Problem fixed, download https://curl.haxx.se/ca/cacert.pemand put it "somewhere", and add this line in php.ini:

问题已解决,下载https://curl.haxx.se/ca/cacert.pem并将其放在“某处”,并将此行添加到php.ini

curl.cainfo = "C:/somewhere/cacert.pem"

PS: I got this error by trying to install module on drupal with xampp.

PS:我在尝试使用 xampp 在 drupal 上安装模块时遇到了这个错误。

回答by TTS Raja

Add the below to php.ini [ use '/' instead of '\' in the path] curl.cainfo= "path/cacert.pem"

将以下内容添加到 php.ini [在路径中使用 '/' 而不是 '\'] curl.cainfo="path/cacert.pem"

Restarted my XAMPP. It worked fine for me. Thanks

重新启动我的 XAMPP。它对我来说很好。谢谢

回答by Khaled AbuShqear

if cacert.pemfrom above links doesn't working try this one worked for me

如果上面链接中的cacert.pem不起作用,试试这个对我有用

https://gist.github.com/VersatilityWerks/5719158/download

https://gist.github.com/VersatilityWerks/5719158/download