php - test - ssl certificate problem: unable to get local issuer certificate wordpress




cURL error 60: SSL certificate prblm: unable to get local issuer certificate (6)

I work with xamps nothing of the above did work for me

I tried this and it worked

  1. open vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php

and change this

$conf[CURLOPT_SSL_VERIFYHOST] = 2;
$conf[CURLOPT_SSL_VERIFYPEER] = true;

to this

$conf[CURLOPT_SSL_VERIFYHOST] = 0;
$conf[CURLOPT_SSL_VERIFYPEER] = FALSE;

it's a temporary solution if you updated this file the changes will lost

This question already has an answer here:

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:

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

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


If you are on windows xampp. I am stealing a better answer from here , would be helpful if Google show you this question 1st.

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

    https://gist.github.com/VersatilityWerks/5719158/download

  2. put it in :

    C:\xampp\php\extras\ssl\cacert.pem

  3. Add this line to your php.ini

    curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

  4. restart your webserver/apache


Seeing I am using a local environment I can safely disable SSL, which i did using the following:

$guzzleClient = new \GuzzleHttp\Client(array( 'curl' => array( CURLOPT_SSL_VERIFYPEER => false, ), ));
$client->setHttpClient($guzzleClient);

Where $client is my Google_Client().


for the essence of development and testing, You have two options to a quick fix

  1. Use
$client = new GuzzleHttp\Client();
$request = $client->request('GET',$url, ['verify' => false]); //where $url is your http address
  1. follow @Pham Huy Anh answer's above then do this
$client = new GuzzleHttp\Client();
$request = $client->request('GET',$url, ['verify' => 'C:\xampp\php\extras\ssl\cacert.pem']);

Hope it helps someone.


$guzzleClient = new \GuzzleHttp\Client(['verify' => false]);





youtube-data-api