后花院 | 静心思考

敦兮其若朴,旷兮其若谷

   使用CURL请求微信接口,https地址,请求后返回false,打印错误结果提示:PHP - SSL certificate error: unable to get local issuer certificate

    查询后在stackoverflow上找到了解决方案,特此记录一下。

    解决方法:

    1、Download the certificate bundle. As Arturo said, get the old cert, just in case you have a new one:ca-bundle.crt

    2、Put it somewhere. In my case that was c:\wamp\ directory (if you are using Wamp 64 bit than it's c:\wamp64\).

    3、Enable mod_ssl in Apache and php_openssl.dll in php.ini. But be careful, my problem was that I had two php.ini files and I need to do this in both of them. One is the one you get from your WAMP taskbar icon, and another one is, in my case, in C:\wamp\bin\php\php5.5.12\

    4、Add these lines to your cert in both php.ini files:

            curl.cainfo="C:/wamp/ca-bundle.crt"
     openssl.cafile="C:/wamp/ca-bundle.crt"

   5、Restart Wamp services.

   PS: ca-bundle.crt 证书下载地址:https://github.com/bagder/ca-bundle/tree/e9175fec5d0c4d42de24ed6d84a06d504d5e5a09

   【确保apache中mod_ssl.so开启,PHP中openssl.dll的extension开启】

    stackoverflow地址:http://stackoverflow.com/questions/28858351/php-ssl-certificate-error-unable-to-get-local-issuer-certificate#


评论

© 后花院 | 静心思考 | Powered by EMLOG | Theme by NIMA

友情链接:Nutcracker