I am following with the article below, https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/web-php
But in the end, when I try with the sample code (HelloAnalytics.php), it will shows the error in command line as follows and cant get the data;
PHP Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\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\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67 PHP Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\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\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67 PHP Fatal error: Uncaught Google_Service_Exception: {"error":{"errors":[{"domain":"usageLimits","reason":"accessNotConfigured","message":"Project 687417168367 is not found and cannot be used for API calls. If it is recently created, enable Google Analytics API by visiting https://console.developers.google.com/apis/api/analytics.googleapis.com/overview?project=687417168367 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","extendedHelp":"https://console.developers.google.com/apis/api/analytics.googleapis.com/overview?project=687417168367"}],"code":403,"message":"Project 687417168367 is not found and cannot be used for API calls. If it is recently created, enable Google Analytics API by visiting https://console.developers.google.com/apis/api/analytics.googleapis.com/overview?project=687417168367 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."}} in C:\xampp\htdocs\vendor\google\apiclient\s in C:\xampp\htdocs\vendor\google\apiclient\src\Google\Http\REST.php on line 118
Fatal error: Uncaught Google_Service_Exception: {"error":{"errors":[{"domain":"usageLimits","reason":"accessNotConfigured","message":"Project 687417168367 is not found and cannot be used for API calls. If it is recently created, enable Google Analytics API by visiting https://console.developers.google.com/apis/api/analytics.googleapis.com/overview?project=687417168367 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","extendedHelp":"https://console.developers.google.com/apis/api/analytics.googleapis.com/overview?project=687417168367"}],"code":403,"message":"Project 687417168367 is not found and cannot be used for API calls. If it is recently created, enable Google Analytics API by visiting https://console.developers.google.com/apis/api/analytics.googleapis.com/overview?project=687417168367 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."}} in C:\xampp\htdocs\vendor\google\apiclient\s in C:\xampp\htdocs\vendor\google\apiclient\src\Google\Http\REST.php on line 118
Can somebody assist me? Thanks
As stated here count(): Parameter must be an array or an object
Please try upgrading your version of Guzzle.
The problem is in PHP 7.2 the parameter for count() can't be NULL. The warning in the first post gets displayed when $this->handles equals NULL. Just replace line 67 in CurlFactory.php with the following:
if (($this->handles ? count($this->handles) : 0) >= $this->maxHandles) {
Some people could meet this issue (in a local environment) when upgrading to Mac OS Catalina. This, upgraded my php version from 7.1 to 7.3, so I had the same issue with CurlFactory (used version 6.2.1 of Guzzle).
This can be fixed by updating your version of Guzzle to 6.3.0 (minimal). How to do this :
"require": {
"guzzlehttp/guzzle": "^6.3.0"
}
Then in a terminal (in the root of your project) :
composer update
OR, if you can't change your Guzzle version (for a reason or another.. This is my case)
Then in a terminal type :
brew update
brew install [email protected]
In some case, you'll have to link to php 7.1 with the following command :
brew link [email protected]
Finally, re-launch your terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With