Fixing It is not safe to rely on the system’s timezone settings on Mac

Fixing Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings on Mac

If you run the following command:

php -i | grep 'Configuration File'

you will receive:

Loaded Configuration File => (none)

This is causing error of unspecified timezone or error:

Warning: date_default_timezone_get(): 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.

To fix it, simply copy the php.ini.default in /etc

cp /etc/php.ini.default /etc/php.ini

sudo vim /etc/php.ini

search for timezone you’ll find a commented line:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

Uncomment it and assign your timezone, example:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/London
Total Views: 25 ,