【问题标题】:"Error SSL certificate problem: unable to get local issuer certificate" when trying to make a phone call with Twilio尝试与 Twilio 通话时出现“错误 SSL 证书问题:无法获取本地颁发者证书”
【发布时间】:2021-03-09 11:51:40
【问题描述】:

我正在尝试使用 Twilio 拨打一个简单的电话,但是,每当我运行尝试拨打电话的功能时,我都会收到某种证书错误 - Error SSL certificate problem: unable to get local issuer certificate。我环顾四周,读到我的本地 PC 证书必须是过时的或什么的,因此我收到错误消息。问题是我使用的是 Windows 7,大多数显示如何修复错误的教程都是针对 Linux 的。有没有一种简单的方法可以在 Windows 中解决这个问题?我也在使用 Apache 和 MAMP。

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Twilio\Rest\Client;

class CallController extends Controller
{
    public function test(Request $request){
        $accountSid = "xxxxxxxxxxxxxxxxxxxxxxx";
        $authToken = "xxxxxxxxxxxxxxxxxxxxxxxx";

        $client = new Client($accountSid, $authToken);

        try {
            $call = $client->calls->create("+xxxxxxxxxxxxx", "+xxxxxxxxxxxxx", array("url" => "http://demo.twilio.com/docs/voice.xml"));
        } catch (\Exception $e) {
            echo "Error " . $e->getMessage();
        }
    }
}

【问题讨论】:

  • 将网址更改为https
  • @train_fox 在 try-catch 块中?我做了,我得到了同样的错误。
  • 好的,那它一定是你的证书。也许你应该为你的本地 apache 设置 ssl。
  • @train_fox 就是这样,我现在正在尝试通过 certbot 安装证书,但它看起来很混乱,尤其是在 Windows 上。
  • 是的,设置证书非常复杂。我记得 :D 我的建议是,如果可以使用 docker,请尝试使用 laradock。然后你应该设置配置,它会为你设置证书而不用担心。

标签: php laravel ssl twilio


【解决方案1】:

打开你的 php.ini,找到并更改这两行

curl.cainfo="C:/location to .pem"
openssl.cafile="C:/location to .pem"

您可以从https://curl.se/docs/caextract.html下载证书

来源:PHP - SSL certificate error: unable to get local issuer certificate

【讨论】:

    猜你喜欢
    • 2019-04-12
    • 2018-06-20
    • 2015-03-18
    • 2011-12-26
    • 2020-10-20
    • 2018-03-07
    • 1970-01-01
    • 2016-07-06
    相关资源
    最近更新 更多