PHP - SSL证书错误:无法获取本地颁发者证书 [英] PHP - SSL certificate error: unable to get local issuer certificate

查看:318
本文介绍了PHP - SSL证书错误:无法获取本地颁发者证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上运行PHP版本5.6.3作为XAMPP的一部分。



当我尝试使用Mandrill API时,我得到以下错误:


未捕获异常Mandrill_HttpError,带有消息API调用消息/ send-template失败:SSL证书问题:无法获取本地发布者证书'


我已经尝试过在StackOverflow上读取的所有内容,包括添加以下内容到php.ini文件:

  curl.cainfo =C:\ xampp\php\cacert.pem

且ofcourse已从 http://curl.haxx.se/docs/caextract.html



但毕竟,重新启动XAMPP和Apache服务器,但仍然获得同样的错误。



我真的不知道要尝试什么。



我可以尝试吗?

解决方案


  • 下载证书包。正如Arturo所说,获得旧的证书,以防万一你有一个新的: ca-bundle.crt


  • 放在某处。在我的case是 c:\wamp \ 目录(如果你使用Wamp 64位比它 c:\wamp64 \ )。在Apache和中启用 mod_ssl php.ini 中的php_openssl.dll 。但要小心,我的问题是,我有两个 php.ini 文件,我需要这两个。一个是你从WAMP任务栏图标获得的,另一个是在我的例子中,在 C:\wamp\bin\php\php5.5.12\


  • php.ini 文件中将以下行添加到您的证书:

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


  • 重新启动Wamp服务。



  • I'm running PHP Version 5.6.3 as part of XAMPP on Windows 7.

    When I try to use the Mandrill API, I'm getting the following error:

    Uncaught exception 'Mandrill_HttpError' with message 'API call to messages/send-template failed: SSL certificate problem: unable to get local issuer certificate'

    I already tried everything I read on StackOverflow, including adding the following to the php.ini file:

    curl.cainfo = "C:\xampp\php\cacert.pem"
    

    And ofcourse downloaded to that location the cacert.pem file from http://curl.haxx.se/docs/caextract.html

    but after all that, restarted XAMPP and Apache server but still getting the same error.

    I really don't know what else to try.

    Can anyone advise on what else can I try?

    解决方案

    Finally got this to work!

    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.

    这篇关于PHP - SSL证书错误:无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆