New PHP release a date() function issue

Support/Development for PHP
laughingbuddha
Forum Regular
Forum Regular
Posts: 512
Joined: Mon Mar 10, 2008 9:12 pm
Location: Southampton, UK

New PHP release a date() function issue

Unread post 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?
Matt

"Given that God is infinite, and that the universe is also infinite... would you like a toasted teacake?"

about.me/mattauckland
twitter.com/mattauckland
biggles
Forum Regular
Forum Regular
Posts: 806
Joined: Tue Jul 15, 2008 2:38 pm
Location: Sweden
Contact:

Re: New PHP release a date() function issue

Unread post by biggles »

laughingbuddha
Forum Regular
Forum Regular
Posts: 512
Joined: Mon Mar 10, 2008 9:12 pm
Location: Southampton, UK

Re: New PHP release a date() function issue

Unread post by laughingbuddha »

That's what I thought. Where is the main php.ini file for the server running Plesk?
Matt

"Given that God is infinite, and that the universe is also infinite... would you like a toasted teacake?"

about.me/mattauckland
twitter.com/mattauckland
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: New PHP release a date() function issue

Unread post 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
laughingbuddha
Forum Regular
Forum Regular
Posts: 512
Joined: Mon Mar 10, 2008 9:12 pm
Location: Southampton, UK

Re: New PHP release a date() function issue

Unread post by laughingbuddha »

Should you set the date.sunrise.zenith and date.sunset.zenith too, or doesn't it really matter?
Matt

"Given that God is infinite, and that the universe is also infinite... would you like a toasted teacake?"

about.me/mattauckland
twitter.com/mattauckland
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: New PHP release a date() function issue

Unread post by scott »

heh, seriously php? You track the sunrise now??

And no :P I didnt even notice that one
laughingbuddha
Forum Regular
Forum Regular
Posts: 512
Joined: Mon Mar 10, 2008 9:12 pm
Location: Southampton, UK

Re: New PHP release a date() function issue

Unread post 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
Matt

"Given that God is infinite, and that the universe is also infinite... would you like a toasted teacake?"

about.me/mattauckland
twitter.com/mattauckland
Post Reply