Error Log - date_default_timezone_set() - what's this about?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Error Log - date_default_timezone_set() - what's this about?

Post by simonmlewis »

Code: Select all

[Sun May 04 10:20:38 2014] [warn] [client 81.19.188.235] mod_fcgid: stderr: PHP 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 /var/www/vhosts/site.fr/httpdocs/index.php on line 442, referer: http://www.site.fr/
We are getting a lot of these in our error log. The site is hosting on a UK server, with many other sites NOT designed for France.

Is this error saying I am using a script calling the date, but it's not set on the server??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Error Log - date_default_timezone_set() - what's this ab

Post by Celauran »

You just need to set the time zone in your php.ini. If you don't have access to php.ini, you can use date_default_timezone_set() instead.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Error Log - date_default_timezone_set() - what's this ab

Post by simonmlewis »

Can it be set in Plesk under the larger box: Additional configuration directives ?

date_default_timezone_set('Europe/Paris');
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Error Log - date_default_timezone_set() - what's this ab

Post by simonmlewis »

Bingo yes, as we have this on another server:
date.timezone = "Europe/London"
In that very box.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply