3
votes

I have ZendServer CE (PHP 5.2) installed on a Fedora VM, and I have the system timezone set to 'America/Chicago'. I have date.timezone = 'UTC' in my php.ini file, and when I call date_default_timezone_get(), or display date('T') on a web page, it says 'CDT'.

The documentation on php.net for date_default_timezone_get() says it follows this order when choosing a default timezone:

 - Reading the timezone set using the
   date_default_timezone_set() function
   (if any)
 - Reading the TZ environment variable
   (if non empty)
 - Reading the value of the
   date.timezone ini option (if set)
 - Querying the host operating system
   (if supported and allowed by the OS)

If I change the system timezone through the 'setup' GUI, and reboot the server, date('T') returns whatever I changed the system timezone to, regardless of what php.ini says. I also don't have a TZ environment variable, and I am not currently using date_default_timezone_set() anywhere in my code.

Any idea what might be going on? I realize I can always override the system timezone by calling date_default_timezone_set('UTC'), but I'd rather rely on the php.ini file if possible.

Thanks for the help,

Dave

1

1 Answers

1
votes

I think you have TZ set, even though you think you don't. Please be careful, check this tutorial to understand TZ better.

http://www.cyberciti.biz/tips/date-command-set-tz-environment-variable.html http://www.cyberciti.biz/faq/howto-linux-unix-change-setup-timezone-tz-variable/

Also try to see what is in your user's .bashrc