为什么我出现致命错误:消息为"cURL错误60"的未捕获异常"GuzzleHttp \ Exception \ RequestException" [英] Why I am getting Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60

查看:1821
本文介绍了为什么我出现致命错误:消息为"cURL错误60"的未捕获异常"GuzzleHttp \ Exception \ RequestException"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am doing project in laravel. I am using plivo api for sending sms. For that I followed all the steps mentioned at

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

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

but When I tried to run my php file then I am getting error message as

致命错误:消息为'cURL错误60的未捕获异常'GuzzleHttp \ Exception \ RequestException':SSL证书问题:证书链中的自签名证书(请参见

"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文件看起来像

My php file looks like,

<?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>";

?>

我没有解决该问题的方法.请提供帮助,并在此先感谢.

I am not getting how to solve this problem. please help and many thanks in advance.

推荐答案

请勿禁用SSL

相反,修复您的PHP安装.

这些说明在Windows上为我工作.

These directions worked for me on Windows.

当您的CA根证书丢失或过时时,会出现此问题.由于目前 ALL ,Windows平台的PHP安装程序请勿包括在发行版中的CA根证书,因此它在Windows上比在Linux上更为常见.

This problem shows up when your CA root certificates are missing or out-of-date. Since at the moment ALL the Windows platform PHP installers DO NOT include the CA root certificates in the distribution, its much more common on Windows than on Linux.

这是更新CA根证书的方式:

Here is how you update the CA root certificates:

  1. 下载最新的CA根证书副本. li>
  2. 将文件"cacert.pem"保存到您的计算机.例如 c:\ xampp \ php
  3. 步骤2 中的"cacert.pem"文件的位置添加到您的 php.ini 文件中.
    在您的 php.ini 文件中搜索[curl],然后更新或添加以下行:
    curl.cainfo=c:\xampp\php\cacert.pem
  4. 重新启动您的Web服务器.
  1. Download an up-to-date copy of CA root certificates.
  2. Save the file "cacert.pem" to your computer. For example c:\xampp\php
  3. Add the location of the "cacert.pem" file from Step 2 to your php.ini file.
    Search for [curl] in your php.ini file and update or add the following line:
    curl.cainfo=c:\xampp\php\cacert.pem
  4. Restart your web server.

Curl现在具有有效的CA根证书捆绑包,并且可以验证远程服务器的SSL证书.

Curl now has a valid CA root certificate bundle and can verify the SSL certificates of remote servers.

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

If you are running any of the Google Cloud Platform PHP examples on a Windows computer you'll get the following cURL error : CURLE_SSL_CACERT (60) - Peer certificate cannot be authenticated with known CA certificates. That error should now be self-explanatory along with how to fix it.

这篇关于为什么我出现致命错误:消息为"cURL错误60"的未捕获异常"GuzzleHttp \ Exception \ RequestException"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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