简体   繁体   English

PHP cURL 错误代码 60

[英]PHP cURL error code 60

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: 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:

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 索引卷曲参考

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"

i fixed this by modifying php.ini file at C:\\wamp\\bin\\apache\\apache2.4.9\\bin\\ 我通过在C:\\wamp\\bin\\apache\\apache2.4.9\\bin\\修改php.ini文件来修复此问题

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

first i was trying by modifying php.ini file at C:\\wamp\\bin\\php\\php5.5.12\\ and it didn't work. 首先,我试图修改C:\\wamp\\bin\\php\\php5.5.12\\ php.ini文件,但它无法正常工作。

hope this helps someone who is searching for the right php.ini to modify 希望这可以帮助正在搜索正确的php.ini进行修改

@Overflowh I tried the above answer also with no luck. @Overflowh我也试过上面的答案,但没有运气。 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. 我将php版本从5.3.24更改为5.5.8,因为此设置仅适用于php 5.3.7及更高版本。 I then found this http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue I 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. 然后我发现这个http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue我从那里下载了cacert.pem并替换了我从curl.hxxx.se下载/制作的那个以上链接,一切都开始工作。 I was trying to get paypal sandbox IPN to verify. 我试图让paypal沙盒IPN验证。 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. 很高兴在.pem交换之后说完所有可以使用php.ini中的curl.cainfo设置,但仍然不在5.3.24中。

php --ini

This will tell you exactly which php.ini file is being loaded, so you know which one to modify. 这将告诉您正在加载哪个php.ini文件,因此您知道要修改哪个。 I wasted a lot of time changing the wrong php.ini file because I had WAMP and XAMPP installed. 我浪费了很多时间来更改错误的php.ini文件,因为我安装了WAMP和XAMPP。

Also, don't forget to restart the WAMP server (or whatever you use) after changing php.ini. 此外,不要忘记在更改php.ini后重新启动WAMP服务器(或任何您使用的)。

@Hüseyin BABAL @HüseyinBABAL

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

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. 使用它不需要添加任何证书或任何东西。

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. 确保您的Window Explorer直接打开“php.ini”文件。 (in my case: “C:\\DevPrograms\\wamp64\\bin\\php\\php5.6.25\\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. 不要在系统托盘的Wamp / Xampp图标菜单中使用“php.ini”的快捷方式。 This shortcut didn't work in some cases I faced. 在我遇到的某些情况下,这条捷径不起作用。

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. 完成。

Problem fixed, download https://curl.haxx.se/ca/cacert.pem and 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上安装模块时出现此错误。

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. 重启了我的XAMPP。 It worked fine for me. 它对我来说很好。 Thanks 谢谢

if cacert.pem from 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

First you have to download the certificate from this link 首先,您必须从此链接下载证书

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

and put it in a location you want the name of downloadable file is : cacert.pem So in my case I will put it under C:\\wamp64\\bin\\php\\cacert.pem 并把它放在你想要的可下载文件名称的位置:cacert.pem所以在我的情况下我会把它放在C:\\ wamp64 \\ bin \\ php \\ cacert.pem下

Then you have to specify the location of the php.ini file 然后你必须指定php.ini文件的位置

For example, I am using php 7 the php.ini file is located at : C:\\wamp64\\bin\\php\\php7.0.10\\php.ini 例如,我使用php 7 php.ini文件位于:C:\\ wamp64 \\ bin \\ php \\ php7.0.10 \\ php.ini

So access to that file and uncommit this line ;openssl.cafile 因此,访问该文件并取消提交此行; openssl.cafile

also update it to be looks like this openssl.cafile="C:\\wamp64\\bin\\php\\cacert.pem" 也更新它看起来像这样openssl.cafile =“C:\\ wamp64 \\ bin \\ php \\ cacert.pem”

Finally restart your apache server and that's all 最后重启你的apache服务器就是这样

Just so you know what worked for me, The file at https://curl.haxx.se/ca/cacert .... did not work however, the one in the zip folder in the post at ( http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue ) worked for me with no issues at all. 只要你知道我什么工作,在该文件https://curl.haxx.se/ca/cacert ....没有然而工作,一个在后,在(Zip文件夹的http:// flwebsites .biz / posts / how-fix-curl-error-60-ssl-issue )对我没有任何问题。

As others have said, copy the certificate file to a location on your hard drive, update the line 正如其他人所说,将证书文件复制到硬盘驱动器上的某个位置,更新该行

;curl.cainfo 

in your php.ini file to read 在你的php.ini文件中阅读

curl.cainfo= "path_to_cert\cacert.pem"

Restart your Apache server. 重启Apache服务器。

The solution is to edit the file php.ini located in your php version(for me it's php7.0.10) not the php.ini of apache. 解决方案是编辑php版本中的php.ini文件(对我而言是php7.0.10)而不是apache的php.ini。 You will find a commented file like this ;curl.cainfo Just change this line like this curl.cainfo = "C:\\permCertificate\\cacert.pem" 你会发现这样的评论文件; curl.cainfo只需像这样改变这一行curl.cainfo =“C:\\ permCertificate \\ cacert.pem”

Don't forget to create the "permCertificate" directory and copy the "cacert.pem" file inside it. 不要忘记创建“permCertificate”目录并复制其中的“cacert.pem”文件。

IMPORTANT : after 4 hours , working with laravel 5.7 and php 7.+ and run/use php artison serve on localhost trying to connect to mailgun . 重要提示 :4小时后,使用laravel 5.7和php 7. +并运行/使用php artison在localhost上尝试连接到mailgun。

IMPORTANT to Resolve the problem do not work with ip http://127.0.0.1:8000 use localhost or set domain name by host file 重要要解决该问题不与知识产权工作http://127.0.0.1:8000由主机文件使用localhost或设置域名

ok , 好 ,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM