cURL 错误 60:SSL 证书 prblm:无法获取本地颁发者证书

cURL error 60: SSL certificate prblm: unable to get local issuer certificate(cURL 错误 60:SSL 证书 prblm:无法获取本地颁发者证书)
本文介绍了cURL 错误 60:SSL 证书 prblm:无法获取本地颁发者证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 YouTube 数据 API 收集上传到特定频道的视频列表.但是,在在线实施之前,我试图让我的代码在离线环境(WAMPserver、PHP 5.5.12、Apache 2.4.9)上运行.我正在使用以下代码:

I want to collect a list of videos uploaded on a specific channel using the YouTube data API. However, before implementing online I am trying to get my code running on an offline environment (WAMPserver, PHP 5.5.12, Apache 2.4.9). I am using the following code:

require_once 'google-api-php-client-2.0.0-RC5/vendor/autoload.php';

$client = new Google_Client();
$client->setApplicationName("SRC_Thor");
$client->setDeveloperKey("xxxxxxxxxxx");

$youtube = new Google_Service_YouTube($client);

$channelResponse = $youtube->channels->listChannels('contentDetails', []);
var_dump($channelResponse);

但是它给出了以下错误:

However it gives the following error:

致命错误:未捕获异常 'GuzzleHttpExceptionRequestException' 并带有消息 'cURL 错误 60:SSL 证书问题:无法获取本地颁发者证书(请参阅 http://curl.haxx.se/libcurl/c/libcurl-errors.html)'

Fatal error: Uncaught exception 'GuzzleHttpExceptionRequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'

我已尝试添加最新版本的 cacert.pem 作为 SO 上的大多数主题提供的解决方案,但无济于事.

I have tried adding the latest version of cacert.pem as most topics on SO offer as a solution, however to no avail.

推荐答案

如果你在 Windows 上使用 Xampp,我从 窃取了一个更好的答案此处,如果 Google 先向您显示此问题会很有帮助.

If you are on Windows using Xampp, I am stealing a better answer from here, would be helpful if Google shows you this question first.

  1. 在此处下载并提取 cacert.pem(干净的文件格式/数据)

  1. Download and extract for cacert.pem here (a clean file format/data)

https://curl.haxx.se/docs/caextract.html

  • 放入:

  • Put it in :

    C:xamppphpextrassslcacert.pem

    C:xamppphpextrassslcacert.pem

  • 将此行添加到您的 php.ini

  • Add this line to your php.ini

    curl.cainfo = "C:xamppphpextrassslcacert.pem"

    curl.cainfo = "C:xamppphpextrassslcacert.pem"

  • 重启你的网络服务器/Apache

  • restart your webserver/Apache

    这篇关于cURL 错误 60:SSL 证书 prblm:无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

  • 本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

    相关文档推荐

    Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
    in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
    all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
    trim function is giving unexpected values php(Trim函数提供了意外的值php)
    Basic PDO connection to MySQL(到MySQL的基本PDO连接)
    PHP number_format returns 1.00(Php number_Format返回1.00)