PHP You cannot rely on the system time zone settings.

I just activated / installed PHP and mySQL on my Mac, and everything seemed to be going fine until I got access to a table that used dates.

On a real server, where I previously developed the site, the exact same page worked fine.

On my local site, I get the following messages for each row of the table:

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system 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 'Europe/London' for 'BST/1.0/DST' instead in /Users/mysite/Sites/testsite/index.php on line 26

Warning: date() [function.date]: It is not safe to rely on the system 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 'Europe/London' for 'BST/1.0/DST' instead in /Users/mysite/Sites/testsite/index.php on line 26

Any ideas how to stop this. I guess I need to change the settings somewhere.

+4
source share
1 answer

Any ideas how to stop this.

The error message tells you how to stop this.

You need to use the date.timezone parameter or the date_default_timezone_set () function.

Update the php.ini PHP installation php.ini (most likely /etc/php.ini ) with the date.timezone setting or use date_default_timezone_set() in your scripts.

You are only now seeing this because it starts in PHP 5.3+.

+12
source

All Articles