1. Home
  2. Programming Tools
  3. Not safe to rely on system’s timezone settings -PHP Warning

Not safe to rely on system’s timezone settings -PHP Warning

Here’s another error related to Datawrapper installation – “PHP warning:  It is not safe to rely on system’s timezone settings“. Below is the complete error message from Apache error_log file.

[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

How to set timezone in PHP.ini

Solution: You need to set timezone in php.ini file.

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:

 ; Defines the default timezone used by the date functions
 ; http://php.net/date.timezone

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.

#vim /public_html/php.ini

Related Content
Updated on September 2, 2017

Was this article helpful?

Related Articles

Add A Comment