simplexml_load_file():无法启用加密

Recently upgraded our IIS and PHP (5.6.3) is now giving me this error.

A lot of the fixes around this seem to point towards changing curl options but we are using simplexml_load_file() all across the project, it seems like it would be a pain to rewrite all our instances using curl requests. Is there a more universal solution to this problem?

Is there something I could change in openssl.cnf or in php.ini to disable this extra security. There is no feasible way for this connection to not be loading files off our own server so I don't mind disabling certificate checking (which appears to be the cause of the problem)

For Ubantu

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

1 brew install openssl

This installs the openssl certificates to /usr/local/etc/openssl/cert.pem, so we can now use the new PHP 5.6 INI setting openssl.cafile to tell PHP where to find the certificates

Adding

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

to Zend Server’s php.ini solved the problem and I can now use composer once again!

for more details please 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

here you can download the root certificates.

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

Then you can use the

CURLOPT_SSL_VERIFYPEER

option with

true

otherwise you get an error.