简体   繁体   English

SSL/TLS 操作失败 PHP5.6 - curl-ca-bundle.crt & cacert.pem

[英]SSL/TLS operations failing PHP5.6 - curl-ca-bundle.crt & cacert.pem

this has been driving me crazy for a couple of weeks now.这已经让我发疯了几个星期了。

I usually do my development on a CentOS 7 box, but recently i've started using Xampp on Windows 10 and using the CentOS box to commit code to & client testing.我通常在 CentOS 7 机器上进行开发,但最近我开始在 Windows 10 上使用 Xampp,并使用 CentOS 机器向客户端测试提交代码。

Everything works fine on the linux box, but on Windows any SSL/TLS calls are failing, and from what I can tell it's due to the new PHP5.6 feature of verifying peer certificates and host names by default - http://php.net/manual/en/migration56.openssl.php在 linux 机器上一切正常,但在 Windows 上,任何 SSL/TLS 调用都失败了,据我所知,这是由于默认情况下验证对等证书和主机名的 PHP5.6 新功能 - http://php。净/手册/en/migration56.openssl.php

I've read just about every how-to guide online, and on SO, and as far as I know I've tried everything, but am getting nowhere.我已经在网上和 SO 上阅读了几乎所有的操作指南,据我所知,我已经尝试了所有方法,但一无所获。

Please can someone help?!请问有人可以帮忙吗?!

Extension extension=php_openssl.dll is enabled in php.ini, and so is extension=php_curl.dll .扩展extension=php_openssl.dll在php.ini文件中激活,所以是extension=php_curl.dll

I've also downloaded cert files and added the following to my php.ini..我还下载了证书文件并将以下内容添加到我的 php.ini 中。

curl.cainfo = "‪C:\xampp\php\certs\curl-ca-bundle.crt"
curl.capath = "‪C:\xampp\php\certs\"


openssl.cafile= "‪C:\xampp\php\certs\curl-ca-bundle.crt"
openssl.capath= "‪C:\xampp\php\certs\"

The errors I am getting are:我得到的错误是:

For SMTP calls using TLS:对于使用 TLS 的 SMTP 调用:

PHP Warning:  stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in W:\libraries\Zend\Mail\Protocol\Smtp.php on line 206

For cURL calls:对于卷曲调用:

API call to messages/send failed: error setting certificate verify locations: CAfile: ‪C:\xampp\php\certs\cacert.pem CApath: none

The contents of the C:\\xampp\\php\\certs\\ directory is: C:\\xampp\\php\\certs\\目录的内容是:

ca-bundle.trust.crt
cacert.pem
curl-ca-bundle.crt

I have restarted Apache, and even tried using curl.exe as a standalone program in command line, which works fine requesting HTTPS domains (not sure if that is relevant, but I tried it anyway!)我已经重新启动了 Apache,甚至尝试在命令行中使用 curl.exe 作为独立程序,它在请求 HTTPS 域时工作正常(不确定这是否相关,但我还是尝试了!)

I have also tried adding the following to php.ini (and restarting Apache) which has no effect..我还尝试将以下内容添加到 php.ini(并重新启动 Apache),但没有效果。

openssl.verify_peer= false
openssl.verify_peer_name = false

Any ideas?有任何想法吗?

The error message error setting certificate verify locations comes from libcurl itself and means it couldn't find or open the CAFile specified.错误消息error setting certificate verify locations来自 libcurl 本身,意味着它无法找到或打开指定的 CAFile。

On Windows, I think it will work if you change the path from:在 Windows 上,我认为如果您更改路径,它会起作用:

curl.cainfo = "‪C:\xampp\php\certs\curl-ca-bundle.crt"

to

curl.cainfo = "‪C:/xampp/php/certs/curl-ca-bundle.crt"

The same probably goes for OpenSSL but I haven't tested to confirm. OpenSSL 可能也是如此,但我还没有测试确认。

原来这是一个权限问题,证书文件没有被读取 - 将C:/xampp/php/certs/文件夹移动到另一个位置(例如在我的用户目录中)解决了这个问题:)

getting this error after renewing certificates from godaddy.从godaddy更新证书后出现此错误。 I am using curl_init when sending request from client site Error: 0200100D:system library:fopen:Permission denied我在从客户端站点发送请求时使用 curl_init 错误:0200100D:system library:fopen:Permission denied

any help任何帮助

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

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