googleworkspace / php-samples

PHP samples for Google Workspace APIs
Apache License 2.0
288 stars 348 forks source link

Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate #19

Closed zerosdev closed 6 years ago

zerosdev commented 6 years ago

Hi, i tried to run the quickstart.php and got this error

PHP Warning: count(): Parameter must be an array or an object that implements Countable in F:\xampp\htdocs\google-group \vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67

Warning: count(): Parameter must be an array or an object that implements Countable in F:\xampp\htdocs\google-group\vend or\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67 Credentials saved to token.json

grant commented 6 years ago

Sorry for the troubles @ZerosDev, which sample this referring to? What PHP version are you using?

arifamd00 commented 6 years ago

Hi Sir, I am facing following error after entering verification code. I am using PHP 7.2.4 please help me.

"Warning: count(): Parameter must be an array or an object that implements Countable in C:\wamp64\www\My Project\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67

Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\wamp64\www\My Project\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace:

0 C:\wamp64\www\My Project\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)

1 C:\wamp64\www\My Project\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 C:\wamp64\www\My Project\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))

3 C:\wamp64\www\My Project\vendor\guzzlehttp\guzzle\src\Handler\Pro in C:\wamp64\www\My Project\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187"

valehasadli commented 6 years ago

I got same error. I'm using php version 7.2.7. How can I fix this problem?

Gurpreet-bnl commented 6 years ago

Hello Sir, i got same problem please help what can i do.???? i'm using PHP 7.2.4 window 10

Warning: count(): Parameter must be an array or an object that implements Countable in E:\wamp\www\calendar\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67

Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in E:\wamp\www\calendar\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace:

0 E:\wamp\www\calendar\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)

1 E:\wamp\www\calendar\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 E:\wamp\www\calendar\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))

3 E:\wamp\www\calendar\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHt in E:\wamp\www\calendar\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187

grant commented 6 years ago

@arifamd00 @nanophp @Gurpreet-bnl Can you please state which sample you're testing? Please give a link of the instructions you followed.

I just followed the Google Calendar quickstart without problems.

@bshaffer Do you know if there's a problem with the PHP client for Windows users recently?

My logs: https://developers.google.com/calendar/quickstart/php

php quickstart.php
Open the following link in your browser:
https://accounts.google.com/o/oauth2/auth?response_type=code&access_type=offline&client_id=912944168551-55p4mhkpe12gd4kffsmj4611f991epkq.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&state&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly&approval_prompt=auto
Enter verification code: 4/QwBCUbqZ7cKVw5lul8yK0R8ws6DDsv_EgxtXVnhb6NwbUk4BExlinvc
Credentials saved to token.json
Upcoming events:
TypeScript + Clasp Blogpost (2018-08-22T06:00:00-07:00)
CLASP IMPROVEMENTS (2018-08-22T09:15:00-07:00)
(Optional) Tech Googler Perf Training and Q&A [EMEA/AMER] (2018-08-22T10:00:00-07:00)
Apps Script Developer Experience Sync (2018-08-22T12:00:00-07:00)
IDE OP (see email (2018-08-22T15:15:00-07:00)
Cheese on 6 (2018-08-22T16:00:00-07:00)
Work (2018-08-22T18:00:00-07:00)
(Optional) Tech Googler Perf Training and Q&A [APAC] (2018-08-22T18:00:00-07:00)
Dinner (2018-08-22T18:30:00-07:00)
Review Maestro Top Issues (2018-08-23T10:00:00-07:00)
timmerman @ ~/Documents/trash/calphp
❤ php -v
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
erickoledadevrel commented 6 years ago

The message about count() is just a warning, and something that should go away once the PHP library upgrades to a new version of Guzzle. The SSL error is a blocker though, so I've updated the issue title to match.

erickoledadevrel commented 6 years ago

This error indicates that the underlying HTTP libraries can't find a certificate store, and are therefore unable to setup the SSL connection to Google's servers. See the Guzzle library's documentation for information on how to setup a certificate store on your machine.

I've added a troubleshooting section to our PHP quickstarts with the same information:

https://developers.google.com/sheets/api/quickstart/php#troubleshooting

rogerfsg commented 5 years ago

The link to the SSL configuration is on on GuzzlePHP docs http://docs.guzzlephp.org/en/stable/request-options.html#verify-option