簡體   English   中英

為什么我收到致命錯誤:消息為“ cURL錯誤60”的未捕獲異常“ GuzzleHttp \\ Exception \\ RequestException”

[英]Why I am getting Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60

我正在laravel做項目。 我正在使用plivo api發送短信。 為此,我遵循了提到的所有步驟

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

但是當我嘗試運行我的php文件時,我收到了如下錯誤消息:

“致命錯誤:消息'cURL錯誤60的未捕獲異常'GuzzleHttp \\ Exception \\ RequestException':SSL證書問題:證書鏈中的自簽名證書(請參閱http://curl.haxx.se/libcurl/c/libcurl-errors。 html )'在G:\\ Xampp \\ htdocs \\ plivoTrial \\ vendor \\ guzzlehttp \\ guzzle \\ src \\ Handler \\ CurlFactory.php:187堆棧跟蹤:#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 \\處理器\\姜黃素 lFactory))#3 G:\\ Xampp \\ htdocs \\ plivoTrial \\ vendor \\ guzzlehttp \\ guzzle \\ src \\ Handler \\ CurlFactory.php在行187“上的G:\\ Xampp \\ htdocs \\ plivoTria。

我的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安裝

這些指示在Windows上對我有用。

當您的CA根證書丟失或過時時,會出現此問題。 由於目前所有 Windows平台的PHP安裝程序都不在發行版中包含CA根證書,因此Windows上的Linux證書比Linux上的證書更為常見。

這是更新CA根證書的方法:

  1. 下載 CA根證書的最新副本。
  2. 將文件“ cacert.pem”保存到您的計算機。 例如c:\\ xampp \\ php
  3. 步驟2中 “ cacert.pem”文件的位置添加到您的php.ini文件中。
    在您的php.ini文件中搜索[curl]並更新或添加以下行:
    curl.cainfo=c:\\xampp\\php\\cacert.pem
  4. 重新啟動您的Web服務器。

Curl現在具有有效的CA根證書捆綁包,並且可以驗證遠程服務器的SSL證書。

如果您在Windows計算機上運行任何Google Cloud Platform PHP示例 ,則會收到以下cURL錯誤: CURLE_SSL_CACERT(60) -對等證書無法使用已知的CA證書進行身份驗證。 現在,該錯誤以及解決方法應該不言自明。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM