googleworkspace / php-samples

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

Quickstart Error #66

Open Eharth opened 4 years ago

Eharth commented 4 years ago

(Please search existing issues before creating a new one.)

error PHP Warning: count(): Parameter must be an array or an object that implements Countable in D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67 PHP 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 D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace:

0 D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection()

1 D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError()

2 D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish()

3 D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()

4 D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()

5 D:\quickstart\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(72): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()

6 D:\quickstart\v in D:\quickstart\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187

Expected Behavior

Actual Behavior

evry time I try to run php quickstart.php it shows me to open the link and enter the verificatin code

Steps to Reproduce the Problem

  1. the same steps described in quickstart section

Specifications

wiifree commented 4 years ago

Same problem. Please solve this.

llelundberg commented 4 years ago

Similar problem. When I run php quickstart.php in cli i get:

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

Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\familjekalender\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67 No upcoming events found.`

PHP 7.4.7 (cli) (built: Jun 9 2020 13:36:15) ( ZTS Visual C++ 2017 x64 )

wiifree commented 4 years ago

i found a solution. if you run the install command composer require google/apiclient:^2.0 via composer, composer install version 2.0. but the latest version can be found here. check if the "^" is in the composer.json by the google client and run the command composer update. this solve the problem.

llelundberg commented 4 years ago

Thank you, that solved the problem.

To clarify for others: The composer.json contained: "require": { "google/apiclient": "2.0" }

Changed to: "require": { "google/apiclient": "^2.0" }

The problem was caused by the Windows command line, the ^ is a special character. Example:

C:>echo composer require google/apiclient:^2.0 composer require google/apiclient:2.0

The special character need to be escaped when following the quickstart guide. Perhaps this should be a new issue? Can anyone come up with a cross-platform command to type in the quickstart guide? Something that works in both CMD and bash?

llelundberg commented 4 years ago

composer require "google/apiclient:^2.0" would work in windows command line. Would it break anything in bash or other consoles?

ghost commented 3 years ago

I did "^" thing but my cmd shows vendor folder files list.