4

I have just activated/installed PHP and mySQL on my Mac and all seemed to be going well until I accessed a table which used dates.

On the live server - where I was previously developing the site - exactly the same page worked fine.

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

Warning: strtotime() [function.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 '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'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 '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'm guessing I need to change a setting somewhere.

Tom
  • 12,776
  • 48
  • 145
  • 240
  • 2
    I'm guessing the only thing you need is read the error message, not just copy/paste it on stackoverflow. – Carlos Campderrós May 17 '11 at 14:59
  • possible duplicate of [date(): It is not safe to rely on the system's timezone settings in codeigniter](http://stackoverflow.com/questions/16765158/date-it-is-not-safe-to-rely-on-the-systems-timezone-settings-in-codeigniter) – Álvaro González Jan 16 '14 at 17:18
  • ***Note:*** The `php-cli`'s `php.ini` file is different then `apache2`'s `php.ini` file. I suggest symbolic linking one to another to keep them in sync and avoid confusion! – recursion.ninja Feb 15 '14 at 19:46

1 Answers1

12

Any ideas how to stop this.

The error message tells you how to stop this.

You are required to use the date.timezone setting or the date_default_timezone_set() function.

Update your PHP installation's php.ini (likely /etc/php.ini) file to have a date.timezone setting, or use date_default_timezone_set() in your scripts.

You're only now seeing this because it starts happening in PHP 5.3+.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368