Not safe to rely on system’s timezone settings -PHP Warning
- Friday, March 10, 2017 By Ramya Santhosh
[Thu Feb 23 13:18:15.040832 2017] [:error] PHP Warning: phpinfo(): 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. in /public_html/phpinfo.php on line 1
Solution: You need to set timezone in
Firstly find out the timezone set in the server as below:
# date Thu Mar 2 12:23:49 CET 2017
Find out which php.ini is used:
#php -i | grep php.ini
Then add the corresponding time zone. You should have a block like this in php.ini:
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone="Europe/Vienna";
You can find out the List of supported timezones.
If you don’t have the permission to update in the actual php.ini, then you can create the one under your public_html folder and add the above contents.