cURL错误60:SSL证书prblm:无法获取本地颁发者证书 [英] cURL error 60: SSL certificate prblm: unable to get local issuer certificate
问题描述
我想收集使用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);
但是会出现以下错误:
致命错误:消息'cURL错误60的未捕获异常'GuzzleHttp \ Exception \ RequestException':SSL证书问题:无法获取本地颁发者证书(请参见
http://curl.haxx.se/libcurl/c/libcurl-errors.html
)
我尝试添加最新版本的cacert.pem
作为解决方案的大多数主题,但是没有用.
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.
-
在此处下载并提取cacert.pem(干净的文件格式/数据)
Download and extract for cacert.pem here (a clean file format/data)
将其放入:
Put it in :
C:\ xampp \ php \ extras \ ssl \ cacert.pem
C:\xampp\php\extras\ssl\cacert.pem
将此行添加到您的php.ini
Add this line to your php.ini
curl.cainfo ="C:\ xampp \ php \ extras \ ssl \ cacert.pem"
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
重新启动您的Web服务器/Apache
restart your webserver/Apache
这篇关于cURL错误60:SSL证书prblm:无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!