0

I'm following Google developer's suggestions to use GA API with PHP (https://developers.google.com/analytics/devguides/config/mgmt/v3/quickstart/service-php).

When I run the last step (On terminal, on mac): -Run the sample using:

php HelloAnalytics.php

I'm getting the following message:

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

I've updated my php.ini file to the right timezone:

date.timezone = "America/Bogota"

But I keep getting the same message.

Nissa
  • 4,636
  • 8
  • 29
  • 37
  • 1
    Make sure you're updating the right php.ini. Some systems have different ones for web-based and CLI. You can check by doing `php --ini` – aynber Feb 08 '17 at 19:10
  • Make sure you restart your webserver (or PHP-FPM if you're using that) after changing `php.ini`, too. – ceejayoz Feb 08 '17 at 19:33
  • Thank you so much! I manage to fix it. I checked the php --ini and had no php.ini file: Configuration File (php.ini) Path: /etc Loaded Configuration File: (none) Scan for additional .ini files in: /Library/Server/Web/Config/php Additional .ini files parsed: (none) So I moved an php.ini file to the etc location and it all worked. I am so happy! Thank you very much! – Antanas Pérez Feb 08 '17 at 21:43
  • @AntanasPérez can u plz explain more how u fixed ? i m facing same issue – KOTIOS Jun 19 '17 at 04:06
  • this answer worked ! : #ref : https://stackoverflow.com/questions/40515949/where-ini-files-on-macosx-sierra – KOTIOS Jun 19 '17 at 04:19

0 Answers0