Page 1 of 1

New PHP release a date() function issue

Posted: Wed Apr 20, 2011 8:48 am
by laughingbuddha
Hi all,

I've noticed the recent update to PHP has introduced an issue with the date() function. I'm now getting timezone warnings in the logs when using the date() function.

Code: Select all

PHP Warning: date() [<a href='function.date'>function.date</a>]: 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
I've read somewhere online that you need to set the date.timezone directive the php.ini.

Now since the update which was yesterday, I haven't rebooted the server. So is the date.timezone directive already set and it is a case of rebooting, or do I have to set the value myself, and if so can it be set in a global php.ini file (server wide) or will it have to be set on per domain basis?

Re: New PHP release a date() function issue

Posted: Wed Apr 20, 2011 8:51 am
by biggles

Re: New PHP release a date() function issue

Posted: Wed Apr 20, 2011 8:56 am
by laughingbuddha
That's what I thought. Where is the main php.ini file for the server running Plesk?

Re: New PHP release a date() function issue

Posted: Wed Apr 20, 2011 9:06 am
by scott
Its in /etc/php.ini, heres what I use in mine to get rid of those messages:

date.timezone = "America/New_York"


You can also override that in the PHP code, but I was way too lazy for that :P

Re: New PHP release a date() function issue

Posted: Wed Apr 20, 2011 9:18 am
by laughingbuddha
Should you set the date.sunrise.zenith and date.sunset.zenith too, or doesn't it really matter?

Re: New PHP release a date() function issue

Posted: Wed Apr 20, 2011 9:36 am
by scott
heh, seriously php? You track the sunrise now??

And no :P I didnt even notice that one

Re: New PHP release a date() function issue

Posted: Wed Apr 20, 2011 9:56 am
by laughingbuddha
Yeah it is in there, not that I could work out online what the settings are for my zone (UK), so I kinda skipped that.

I set the date.timezone in php.ini located in /etc but it didn't change. Then I noticed I didn't uncomment it.....dOh!

I set mine like so:

Code: Select all

date.timezone = "Europe/London"

date.default_latitude = 51.4778
date.default_longitude = 0