Twilio PHP - SSL 证书:证书链中的自签名证书 [英] Twilio PHP - SSL certificate: self signed certificate in certificate chain

查看:48
本文介绍了Twilio PHP - SSL 证书:证书链中的自签名证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用他们的 PHP 库通过 Twilio 发送消息时遇到了这个错误:

I'm struggling with this error when trying to send a message via Twilio using their PHP library:

Fatal error: Uncaught exception Services_Twilio_TinyHttpException with message SSL certificate problem: self signed certificate in certificate chain thrown in F:path	osite	wilio-phpServicesTwilioTinyHttp.php on line 119

我在 Windows 7 上使用 wamp.

I'm using wamp on windows 7.

我当然找到了所有其他关于证书错误的帖子.据我所知,通常更新或添加 cacert.pem 文件可以解决问题.但是,即使这样做,我仍然遇到相同的错误.

I have of course found all of the other posts about certificate errors. From what I can see, usually updating or adding the cacert.pem file fixes the issue. However, even after doing this i'm still getting the same error.

就像这里的健全性检查正是我所做的一样:

Just as a sanity check here is exactly what i've done:

  1. 从这里下载最新的证书:http://curl.haxx.se/ca/cacert.pem.
  2. 将此文件放在以下位置 c:/wamp/certs/cacert.pem
  3. 更新 php.ini 如下:curl.cainfo = c:/wamp/certs/cacert.pem
  4. 重启包括 apache 在内的所有 wamp 服务

我仍然遇到同样的错误.我已经确认我正在使用 phpinfo() 编辑正确的 php.ini.我不知道为什么它仍然在抱怨.

And i'm still getting the same error. I have verified that I am editing the correct php.ini using phpinfo(). I'm at a loss as to why it's still complaining.

有什么方法可以 100% 验证我的 cacert.pem 文件是否被找到和读取?我已经检查了 phpinfo() 并且那里没有提到它.它应该在某个地方说它正在使用哪个 cacert.pem 吗?

Is there any way to verify 100% that my cacert.pem file is being found and read? I've checked phpinfo() and there is no mention of it in there. Should it say somewhere which, if any cacert.pem it's using?

谢谢!

推荐答案

我遇到了完全相同的问题

I had the exact same issue

请按照以下步骤操作:

下载以下文件 - cacert.pem

Download the following file - cacert.pem

然后下载以下文件 - thawte_Premium_Server_CA.pem

Then download the following file - thawte_Premium_Server_CA.pem

在文本编辑器中打开第二个文件并将其内容复制到第一个文件中(cacert.pem 在底部/末尾).

Open the second file in a text editor and copy its contents into the first file (cacert.pem at the bottom/end).

保存 cacert.pem 并将以下几行添加到您的 php.ini 中:

Save cacert.pem and add the following lines to your php.ini :

[curl]
curl.cainfo=c:/xampp/php/cacert.pem

显然将目录更改为您的 pem 所在的目录.重启php本地服务器(xampp/wamp).然后它会完美地工作.

Obviously change the directory to the one where your pem is located. Restart the php local server (xampp/wamp). Then it will work flawlessly.

谢谢.

这篇关于Twilio PHP - SSL 证书:证书链中的自签名证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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