php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63339 Set a useful default for date.timezone option
Submitted: 2012-10-23 08:58 UTC Modified: 2016-03-19 22:21 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dirkjan at ochtman dot nl Assigned:
Status: Wont fix Package: *Configuration Issues
PHP Version: 5.4.8 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-10-23 08:58 UTC] dirkjan at ochtman dot nl
Description:
------------
It's pretty silly that PHP requires setting an explicit date.timezone. On both Unices and Windows, it should be pretty easy to get a default timezone from the OS.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-04 07:27 UTC] bmassot at free dot fr
On Linux the guess_timezone() function of ext/date/php_date.c could try to look at /etc/timezone.
 [2016-03-19 21:17 UTC] ctd682001 at yahoo dot com
I am using version 5.6.17 and I am having a similar problem.  Specifically with Raspbian.  PHP reports the timezone as MDT when I have it configured for America/Phoenix which is MST year round.  Not sure where PHP is getting timezone information but my /etc/timezone says America/Phoenix.  If I set default_timezone to America/Phoenix in script the time is correct.
 [2016-03-19 22:21 UTC] derick@php.net
-Status: Open +Status: Wont fix
 [2016-03-19 22:21 UTC] derick@php.net
If it was easy to get the timezone from the OS (it isn't), we would have done so. Since PHP 5.6, the default is now UTC and does not look at the OS at all any more, and there is no warning any more either.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 07:01:26 2019 UTC