gpt4 book ai didi

php - 为什么我收到 fatal error : Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60

转载 作者:太空宇宙 更新时间:2023-11-03 13:25:17 27 4
gpt4 key购买 nike

我正在用 laravel 做项目。我正在使用 plivo api 发送短信。为此,我遵循了

中提到的所有步骤

https://www.plivo.com/docs/getting-started/send-a-single-sms/ .

但是当我尝试运行我的 php 文件时,我收到了错误消息

"Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace: #0 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #3 G:\Xampp\htdocs\plivoTria in G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187".

我的 php 文件看起来像,

<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;

$auth_id = "xxxxxxxxxxxxx";
$auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";

$p = new RestAPI($auth_id, $auth_token);

// Set message parameters
$params = array(
'src' => 'xxxxxxxxxxx',
'dst' => '91xxxxxxxxxx',
'text' => 'Hi, I am Amarja :)',
'url' => 'http://localhost/untitled/sentsms.php',
'method' => 'POST'
);
// Send message
$response = $p->send_message($params);

echo "Response : ";
print_r ($response['response']);

echo "<br> Api ID : {$response['response']['api_id']} <br>";

echo "Message UUID : {$response['response']['message_uuid'][0]} <br>";

?>

我不知道如何解决这个问题。请帮忙,非常感谢。

最佳答案

不要禁用 SSL

相反,修复您的 PHP 安装

These directions在 Windows 上为我工作。

当您的 CA 根证书丢失或过时时,就会出现此问题。由于目前 ALL Windows 平台 PHP 安装程序 DO NOT 在分发中包含 CA 根证书,因此它在 Windows 上比在 Linux 上更常见。

以下是更新 CA 根证书的方法:

  1. > Download CA 根证书的最新副本。
  2. 将文件“cacert.pem”保存到您的计算机。例如c:\xampp\php
  3. 步骤 2 中的“cacert.pem”文件的位置添加到您的 php.ini 文件。
    php.ini 文件中搜索 [curl] 并更新或添加以下行:
    curl.cainfo=c:\xampp\php\cacert.pem
  4. 重新启动您的网络服务器。

Curl 现在有一个有效的 CA 根证书包,可以验证远程服务器的 SSL 证书。

如果您正在运行任何 Google Cloud Platform PHP examples在 Windows 计算机上,您将收到以下 cURL 错误:CURLE_SSL_CACERT (60) - 无法使用已知的 CA 证书对对等证书进行身份验证。该错误以及如何修复它现在应该是不言自明的。

关于php - 为什么我收到 fatal error : Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34264121/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com