最近升级了我们的 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/