6.0.0-beta1
7/8/25

[#2684] Win2K, PHP, time() and TZ
Summary Win2K, PHP, time() and TZ
Queue Horde Base
Queue Version 3.0.5
Type Bug
State Not A Bug
Priority 2. Medium
Owners
Requester rharvey (at) hyvernion (dot) com
Created 09/27/2005 (7224 days ago)
Due
Updated 10/22/2009 (5738 days ago)
Assigned 09/27/2005 (7224 days ago)
Resolved 10/09/2005 (7212 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
10/22/2009 03:36:39 PM peplow (at) t-online (dot) de Comment #8 Reply to this comment
Although the described problem ticket is a little bit older, I faced 
the same problem today. After some research I discovered the following 
reason for the "wrong e-mail time" in Horde on my system:

Some of the Zoneinfo files of my CentOS distribution are not correct.

When I look under /usr/share/Zoneinfo/,

the file for the timezone "Europe/Berlin" contains the variable 
EST5EDT (referencing to Eastern Standard Time),

while the file for the timezone "Europe/Stockholm" contains the 
variable CET-1CEST (referencing to Central European Time).

When I choose the timezone Europe/Berlin, all e-mail times shown in 
Horde are wrong. When I choose Europe/Stockholm instead, everything is 
fine.

So, in my case, it is not a Horde problem but a problem of the Linux version.

I can recommend everyone to have a look into the Zoneinfo files if 
Horde shows the wrong time, and to switch to a timezone that suits the 
needs.

Regards and many thanks to the developers of Horde,

Carsten


10/09/2005 12:22:25 AM Chuck Hagenbuch State ⇒ Not A Bug
 
10/09/2005 12:00:13 AM rharvey (at) hyvernion (dot) com Comment #7 Reply to this comment
Just a lil note to follow up...



I brought the server down and put XP on it..  Knocked off XP's legs 
and wings so it wasn't so much a CPU/Memory hog and Horde hasn't put 
the PHP server time in constant UTC mode.



So lessoned learned, PHP and Win2K don't mix...  But really what does 
Windows mix with??  I really need to learn Linux for server usage..  heh
09/28/2005 03:20:21 PM rharvey (at) hyvernion (dot) com Comment #6 Reply to this comment
lol understood...  I guess my point is the server has been up and 
running for quite sometime, with the time always being reported 
correctly.  I have successfully used and tested other PHP scripts that 
have manipulated the time and date.  Horde is the first to do this.



I am sure it is a PHP prob, at least my instinct tells me this.  Plus 
Win2K don't help since the problem only shows up in Win2K, not XP or 
2003.  I would switch to one of those but the computer can only run, 
with any speed and stability, Win2K.



Of course there is Linux, which I've been a corp IT guy so long 
Windows is all I know and learning Linux is like trying to teach 
myself Latin at age 60.  It's possible I know, I am trying to learn it 
and now I have a reason as I do love Horde, it was perfect..  I was 
trying to put it up on the server for personal use, for my immediate 
family to use as an organizer and way to stay together since we are 
apart alot.  If this was the only use of the server the time would not 
be an issue but the server is also my business server and it makes a 
difference.



Which brings me to the question how is Horde scripted differently than 
the other scripts?  If the issue was suppose to have been resolved 
within PHP for Win2K, how can Horde be coded to accommodate?



I mean something to research and look into is all I am saying.  Maybe 
not, Win2K is being phased out by Microsoft in all reality, but Win2K 
is still widely used for the same reason I use it, on slower systems 
that make good servers.
09/28/2005 08:00:25 AM Jan Schneider Comment #5 Reply to this comment
However, phpinfo() does report thru the whole process of correct and
incorrect times:

Environment:  TZ  America/New York
PHP Variables:  _ENV["TZ"] America/New York
Of course, it's only a variable. If this timezone is unkown to 
Windows, it probably falls back to UTC or whatever. This could explain 
the behaviour.

Try other timezone names like EDT, PST, etc.
09/27/2005 10:25:19 PM rharvey (at) hyvernion (dot) com Comment #4 Reply to this comment
Oh, I also thought about the sugestion of maybe Win2K simply doesn't 
support the (standardized) timezone names you use in Horde.



However, phpinfo() does report thru the whole process of correct and 
incorrect times:



Environment:  TZ  America/New York

PHP Variables:  _ENV["TZ"] America/New York



Same standardized timezone names you use in Horde...  Again, I can't 
think of why only Horde brings this out.
09/27/2005 09:53:03 PM rharvey (at) hyvernion (dot) com Comment #3 Reply to this comment
I ran the script as requested starting with the correct time using the 
America/New York TZ setting in your test script.  These were the 
results:



Tue, 27 Sep 2005 17:33:29 -0400    // correct

Tue, 27 Sep 2005 22:33:29 +0100   // what PHP defaults to



Ok, so the EDT TZ is -4 not -5, I can't keep track of the time changes, lol.

Anyways, when the putenv() is issued PHP goes into a "default" TZ.



Same problem as described on the bug tracker at PHP's website as I had 
mentioned previously.  The folks at PHP identified the issue in 
earlier versions of PHP as a PHP issue and stated it was solved but it 
appears to still be a problem.



According to PHP: "The problem was that putenv("TZ=...") would call 
tzset() in order to update the libc with the timezone information for 
the time related functions, but PHP would not call tzset() again when 
the environment was reset."



I don't know enough of the internal workings of PHP to think of any 
"work arounds"...  I thought maybe making a putenv or setlocale script 
at the start of my webpages to "reset" the PHP TZ but it still does me 
no good within Horde.  Besides, after trying the test script I see it 
wouldn't have worked anyhow.



What's strange is only Horde does this when other web apps that 
manipulate TZ's don't...  <shrug>  This is such a bummer...
09/27/2005 08:22:57 AM Jan Schneider Comment #2
Priority ⇒ 2. Medium
State ⇒ Feedback
Reply to this comment
I don't know Windows well enough regarding timezones, but maybe it 
simply doesn't support the (standardized) timezone names we use in 
Horde?

Call this short script in your browser:

<?php

echo date('r');

putenv('TZ=Pacific/Honolulu');

echo date('r');

?>
09/27/2005 03:06:02 AM rharvey (at) hyvernion (dot) com Comment #1
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Win2K, PHP, time() and TZ
Queue ⇒ Horde Base
State ⇒ Unconfirmed
Reply to this comment
This may be similiar to ticket #1088.  I hope I can supply enough 
information to keep this from being marked bogus. heh



OS: Windows 2000

Apache: 2.0.54

PHP: 5.0.4

MySQL: 4.1.13



My server is set to TZ EDT.



After installing Horde I noticed the time being reported by PHP was 
UTC/GMT/Zulu but my TZ was still EDT (PHP and Horde).  I did some 
research thinking it was a PHP config error on my part.  I found PHP 
(4.3.3) Bug #25825 where PHP on Win2K defaults to UTC time and cannot 
be changed back at times, sometimes a simple reboot will work.  The 
problem was corrected in PHP5 by having PHP reset the TZ variable back 
to original server TZ after each connection.  Of course, the problem 
described below may be totally unrelated.



I made sure it was Horde by rebooting the system and verifing the time 
to be correct and being reported correctly by PHP.  I then logged in 
to all my known correctly working web apps, checking the time each 
step of the way.  I logged into Horde last.  As soon as I logged into 
Horde *poof* the time was UTC (+5 of EDT).



Since the time is +5 off and EDT is suppose to be -5 of GMT I tried to 
reset the TZ in Horde to be Pacific/Honolulu time -10 of GMT.   
Thinking if Horde makes it +5 it would be correct.  Rebooted and seen 
the correct time being reported by PHP and logged into Horde.  Back to 
UTC, ignoring the TZ set in Horde and PHP.



This lil prob renders Horde unusable as Tasks, Mail and the Planner 
all have incorrect UTC times.  I first noticed this when I was testing 
out the Tasks part of Horde and created an alarm and looked to see why 
it didn't go off.



Summary:  Horde causes PHP to report GMT time, regardless of TZ set in 
PHP or Horde.

Saved Queries