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

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
vps germany
Disclaimer: The content published in this article is the views of the author only. Techglimpse does not gurantee accuracy, completness or validity. If you believe the content on this post violates your copyright, please send us a mail for removal. Read more.