In 2007, the NZ government changed daylight savings, by extending it a couple of weeks. Whilst the Linux vendors pushed out updates for tzdata which contains the data needed for your system clock to function, PHP has it’s own timezone database which is causing problems for some systems, where the clock in PHP is being calculated using the old daylight savings time.
Run the following to check if PHP on your server has been updated to the correct timezone:
$ date
$ php -r "echo strftime('%Y-%m-%d %H:%M:%S');";
If the times match, no problem. If they DON’T it means that all dates are being calculated using the old daylight savings time, so from the 16th March until the 6th April, all time shown in PHP applications will be 1 hour behind.
It’s a pity that not all the Linux vendors realised this and released fixes, but I had never even considered that PHP would use a separate timezone database, so it’s quite possible neither did they.
I have tested on the following systems:
- CentOS 4 – PHP 4.3.9 (no problem)
- CentOS 5 – PHP 5.1.6 (wrong time)
It looks like PHP 4 doesn’t suffer from the problem, possibly it uses the system timezone data instead, but I wasn’t able to find a lot of information about this.
Fortunately, you can fix the timezone data without rebuilding PHP. The timezone data can be installed as a separate module (timezonedb), which is used instead of the compiled in timezone data.