Sunday, February 20, 2011

PHP 5.3 Date Timezone issue

I was recently trying to setup PHP on my development machine. I downloaded the php-5.3.5-Win32-VC6-x86.zip for Windows and started to manually configure PHP (to get a feel. You can ofcourse use something like XAMPP to get started quickly.)

Then I quickly executed some PHP scripts and found everything was running fine. I dumped some of the PHP samples I had and played around until one started complaining

It is not safe to rely on the system's timezone settings.

Little researching solved the issue. PHP 5.3 requires you to set date.timezone in php.ini file

e.g. date.timezone = Asia/Calcutta

http://nl3.php.net/manual/en/timezones.php