Warning: strtotime(): 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 /home/luke69/public_html/reviews.php on line 181
Warning: date(): 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 /home/luke69/public_html/reviews.php on line 181
This is just a warning but an important one.
By default, PHP will use your systems time settings, that includes the date and timezone information, among other things.
PHP believes that this isn’t ideal so it wants you to explicitly specify which timezone should be used.
There are two ways to do this.
The first is a global fix, where you set the timezone info in your php.ini file. Open up your php.ini file and look for date.timezone (See date.timezone in the manual) and change the value to a recognized timezone. You can also use ini_set() to do this, btw.
You may have to restart your web server if you make this change in php.ini.
For my limited need of time functions, none of which accuracy is of any importance, it makes no difference that my site’s server is 3 timezones away.
Though for me the Warnings are more an annoyance than anything I need to be worried about the few places I use time functions, I can see where for some sites having the timezones match the site’s geographical location would be essential.
Because my shared host doesn’t allow me access to the ini file, I added this line to the files where needed and it works fine date_default_timezone_set("US/Eastern");
Also, if you look at the table for date.timezone, you can see that the Changeable field has value PHP_INI_ALL which, according to the section titled Where a configuration setting may be set, means the value can be set using one of the following:
ini_set()
php.ini, .htaccess, httpd.conf (apache2.conf) or .user.ini
But since date.timezone() happens to have the date_default_timezone_set() function, that works fine too.