php - simplexml_load_file() : Failed to enable crypto

标签 php windows ssl iis

最近升级了我们的 IIS 和 PHP (5.6.3) 现在给我这个错误。

许多围绕此的修复似乎都指向更改 curl 选项,但我们在整个项目中都使用 simplexml_load_file() ,使用 curl 请求重写所有实例似乎很痛苦。这个问题有没有更通用的解决方案?

我可以在 openssl.cnf 或 php.ini 中更改某些内容以禁用此额外的安全性。没有可行的方法让这个连接不从我们自己的服务器加载文件,所以我不介意禁用证书检查(这似乎是问题的原因)

最佳答案

For Ubuntu

you should have to install openssl for your server let me give you steps.

1 brew install openssl

这会将 openssl 证书安装到 /usr/local/etc/openssl/cert.pem,因此我们现在可以使用新的 PHP 5.6 INI 设置 openssl.cafile告诉 PHP 在哪里可以找到证书。

添加

openssl.cafile=/usr/local/etc/openssl/cert.pem

Zend Server 的 php.ini 解决了这个问题,我现在可以再次使用 composer 了!

更多详情请click here .

For Windows Follow this steps Another problem under Windows is that you don't have access to the certificates. So put the root certificates directly to curl.

http://curl.haxx.se/docs/caextract.html

在这里您可以下载根证书。

curl_setopt($ch, CURLOPT_CAINFO, DIR . "/certs/cacert.pem"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

然后你可以使用:

CURLOPT_SSL_VERIFYPEER

选项:

true

否则会出错。

关于php - simplexml_load_file() : Failed to enable crypto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54145830/

相关文章:

php - 检查表是否存在于电子表格 Google 电子表格 API PHP 中

Javascript 在一段时间内按下按钮

windows - 如何获取在cassandra表中分配的索引列表

windows - 文本 'Extent' 属性不包含正确的大小

javax.net.ssl.SSLHandshakeException : sun. security.validator.ValidatorException:PKIX 路径构建失败:即使我已经创建了证书

google-app-engine - 带有 Google Domain 的 Google Cloud,静态网站 ssl 证书无效

php - mysql 和 php 中的 utf-8

php - 临时命名空间

windows - Windows/cmd 上的可执行文件类型是什么?他们的优先事项是什么?

ssl - Pubnub-CodeNameOne 库 - 缺少方法(访问管理器)