php-samples icon indicating copy to clipboard operation
php-samples copied to clipboard

Quickstart Error

Open Eharth opened this issue 5 years ago • 6 comments

(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

  • PHP version (php 7.4.4):
  • OS (Windows):

Eharth avatar Jun 11 '20 18:06 Eharth

Same problem. Please solve this.

wiifree avatar Jul 12 '20 21:07 wiifree

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 )

llelundberg avatar Jul 15 '20 20:07 llelundberg

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.

wiifree avatar Jul 15 '20 21:07 wiifree

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 avatar Jul 15 '20 21:07 llelundberg

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

llelundberg avatar Jul 15 '20 21:07 llelundberg

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

ghost avatar Nov 20 '20 23:11 ghost