Google-api-php-client: cURL error 60

Created on 10 Feb 2016  路  25Comments  路  Source: googleapis/google-api-php-client

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)' in D:binxampphtdocsgoogle-api-php-clientvendorguzzlehttpguzzlesrcHandlerCurlFactory.php:187 Stack trace: #0 D:binxampphtdocsgoogle-api-php-clientvendorguzzlehttpguzzlesrcHandlerCurlFactory.php(150): GuzzleHttpHandlerCurlFactory::createRejection(Object(GuzzleHttpHandlerEasyHandle), Array) #1 D:binxampphtdocsgoogle-api-php-clientvendorguzzlehttpguzzlesrcHandlerCurlFactory.php(103): GuzzleHttpHandlerCurlFactory::finishError(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory)) #2 D:binxampphtdocsgoogle-api-php-clientvendorguzzlehttpguzzlesrcHandlerCurlHandler.php(43): GuzzleHttpHandlerCurlFactory::finish(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleH in D:binxampphtdocsgoogle-api-php-clientvendorguzzlehttpguzzlesrcHandlerCurlFactory.php on line 187

What is this problem?
How can I solve this?
I checked a lot of links related with this, but no result.
Please help me all.
Thanks for your time.

Most helpful comment

  • Save the following to cacert.pem: https://curl.haxx.se/ca/cacert.pem

  • put it here:

    C:xamppphpextrassslcacert.pem

  • in your php.ini put this line in this section:

    ;;;;;;;;;;;;;;;;;;;;
    ; php.ini Options  ;
    ;;;;;;;;;;;;;;;;;;;;
    
    curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
    
  • restart your webserver/apache

All 25 comments

Hmm, at a glance this seems like an underlying curl problem, or even an underlying Guzzle problem, and not an issue with this library.

This stack overflow provides several ways to work around this problem.

hii ,
i'm having the same problem , how did u slove it please
help

  • Save the following to cacert.pem: https://curl.haxx.se/ca/cacert.pem

  • put it here:

    C:xamppphpextrassslcacert.pem

  • in your php.ini put this line in this section:

    ;;;;;;;;;;;;;;;;;;;;
    ; php.ini Options  ;
    ;;;;;;;;;;;;;;;;;;;;
    
    curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
    
  • restart your webserver/apache

Thank youu ,
i did that but still not working :(

@sarasad it's possible you added it to the wrong php.ini or did not properly restart your web server. Add a file such as this and ensure the curl.cainfo value is as expected:

<?php
// somefile.php

phpinfo();

If that doesn't work, try seeing the guzzle documentation on how to provide your own cert file directly (https://github.com/guzzle/guzzle/issues/394). For this library, it will look something like this:

$http = new GuzzleHttp\Client([
    'verify' => '/path/to/cert.pem'
];
$google = new Google_Client;
$google->setHttpClient($http);

Thank you so much for replying
but still same problem :(
this is the msg i gt exactly :
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)' in C:xampphtdocsapi-samples-masterphpvendorguzzlehttpguzzlesrcHandlerCurlFactory.php:188 Stack trace: #0 C:xampphtdocsapi-samples-masterphpvendorguzzlehttpguzzlesrcHandlerCurlFactory.php(151): GuzzleHttpHandlerCurlFactory::createRejection(Object(GuzzleHttpHandlerEasyHandle), Array) #1 C:xampphtdocsapi-samples-masterphpvendorguzzlehttpguzzlesrcHandlerCurlFactory.php(104): GuzzleHttpHandlerCurlFactory::finishError(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory)) #2 C:xampphtdocsapi-samples-masterphpvendorguzzlehttpguzzlesrcHandlerCurlHandler.php(43): GuzzleHttpHandlerCurlFactory::finish(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandler in C:xampphtdocsapi-samples-masterphpvendorguzzlehttpguzzlesrcHandlerCurlFactory.php on line 188

Looks like this problem occurs from a local location (like your workstation).

Had the same problem.
However, when I uploaded and ran it on my webserver, it works.

Same thing, I'd like to know how to resolve it, running from my machine.

put 'verify' => false

I have same problem! Can you tell me how solve it? @amitsadana444
curl.cainfo = "xxxcacert.pem" it not work
I modify php.ini in xxx/apache/bin

I have WAMP running on my Windows box and was able to solve this issue following @bshaffer instructions but with some minor adjustments. One thing to keep in mind at least if you are running WAMP (not sure if the same applies to LAMP) is that WAMP may be using two different versions of PHP (for me it was version 5 & 7). It uses version 5 for the command line and version 7 for web apps. Here's how I fixed mine:

  1. Placing the cacert.perm from https://curl.haxx.se/ca/cacert.pem in the correct folder. In my case it was "C:wampbinphpphp5.6.19extrasssl".

  2. Modify php.ini, found in folder "C:Wampbinphpphp5.6.19". Find the following section
    ;;;;;;;;;;;;;;;;;;;; ; php.ini Options ; ;;;;;;;;;;;;;;;;;;;;
    and add the following line to that section (modify the folder path to match where you placed the cacert.pem file):
    curl.cainfo = "C:wampbinphpphp5.6.19extrassslcacert.pem"

  3. Save the file

  4. Restart PHP (I just click in the WAMP icon in the system tray and click on "Restart All Services"

You should then be able to run the Google Calendar API Quickstart example.

Thank you bshaffer. Worked for me. Using xampp in windows

@ATXcoder did not work on wamp. I still get the same errors.

@bshaffer Adding cacert.pem did the trick for me on XAMPP Windows. Thanks!

See how this guy fixed it: https://translate.google.bg/translate?hl=en&sl=ja&u=https://qiita.com/kd9951/items/c5d2add24afe861ebe2e&prev=search

i have another apprrocahe it works for me
open vendorguzzlehttpguzzlesrcHandlerCurlFactory.php

and change thsi

$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 upated this file the changes will lost

thanks @abdul202 it is working

thanks @abdul202 also worked for me.

  • Save the following to cacert.pem: https://curl.haxx.se/ca/cacert.pem
  • put it here:
    > C:xamppphpextrassslcacert.pem
  • in your php.ini put this line in this section:

    ;;;;;;;;;;;;;;;;;;;;
    ; php.ini Options  ;
    ;;;;;;;;;;;;;;;;;;;;
    
    curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
    
  • restart your webserver/apache

I follw your steps, and solve this problem, thanks!

is there a way to temporarily disable ssl checking like a static field somewhere?
It's a pain to develop these things in windows...

@beppe9000,

You can provide your own HTTP client with SSL verification disabled. Of course, you should never use this in production.

$client = new Google_Client();
$guzzle = new GuzzleHttp\Client([
    'verify' => false
]);
$client->setHttpClient($guzzle);

See here for more information.

@ATXcoder thanks for tip about different versions of php running on local machine. I have 4 versions, and I just applied your solution to all 4 version, and error is gone. Thanks

Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404
mobixpress.com
Apache/2.4.39 (Win64) OpenSSL/1.1.1c PHP/7.3.6

i'm getting this error
my site will reach on facebook login but when its redirect to my localhost which name is mobixpress.com it will through this error which i've mention above.
i know its a error of https or ssl
but i dont know how to resolve it
any one can please help me

i have another apprrocahe it works for me
open vendorguzzlehttpguzzlesrcHandlerCurlFactory.php

and change thsi

$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 upated this file the changes will lost

thank you so much its working fine.

@attuarrahman while I'm glad that is helping, it is not a good idea to make manual changes to external libraries. When you run composer update those changes will be overwritten. I shared above how to configure your client without changes to external code.

That said, if you are experiencing this issue on your production server, I strongly advise that you work with whoever manages your hosting to address the issue. It is very dangerous to disable SSL verification in production. If you are doing this in development, I'd still suggest working to address the underlying problem, though it's less urgent so long as you are careful not to let that change make it to production.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dresing picture Dresing  路  3Comments

usamamashkoor picture usamamashkoor  路  5Comments

cmcfadden picture cmcfadden  路  5Comments

whatido1 picture whatido1  路  3Comments

mevsme picture mevsme  路  4Comments