ID: 24603 Updated by: [EMAIL PROTECTED] Reported By: akorthaus at web dot de Status: Bogus Bug Type: Date/time related Operating System: RedHat-Linux 7.3, kernel 2.4.20 PHP Version: 4.3.2 New Comment:
Something, somewhere in your system sets the timezone to BST. I just listed all possible reasons why this is bogus. :) Previous Comments: ------------------------------------------------------------------------ [2003-07-11 11:28:48] akorthaus at web dot de If it was a problem of DST, the output should have been: 17:20:09 CET 16:20:09 GMT Fri Jul 11 18:20:09 CEST 2003 CET : Central Europe Time CEST : Central Europe Summer Time BST : British Summer Time ------------------------------------------------------------------------ [2003-07-11 11:25:34] akorthaus at web dot de That's what I get with your code: 17:20:09 BST 16:20:09 GMT Fri Jul 11 18:20:09 CEST 2003 No, The Problem is, that PHP doesn't use my local time, it doesn't use CEST as "date" in shell does, it uses BST. Why does PHP use a timezone I nerver used somewhere? Where does PHP get this information from? Or is it set at compile-time? Because at that time it was BST not, CEST. ------------------------------------------------------------------------ [2003-07-11 10:51:16] [EMAIL PROTECTED] We are happy to tell you that you just discovered Daylight Savings Time. For more information see: http://webexhibits.org/daylightsaving/b.html Instead of using mktime/date consider using gmmktime and gmdate which do not suffer from DST. Borked system. Works fine here: 18:49:44 EEST 15:49:44 GMT Fri Jul 11 18:49:44 EEST 2003 script: <?php echo date("H:i:s T"), "\n"; echo gmdate("H:i:s T"),"\n"; echo exec('date'), "\n"; ?> Remember the DST... ------------------------------------------------------------------------ [2003-07-11 08:01:18] akorthaus at web dot de Description: ------------ Hi! Now I'm trying to solve this problem for more then 10 houres, nad nobody seems to know what is going wrong here. If I try this: <?php echo date("H:i:s")."\n"; echo gmdate("H:i:s"); ?> That displays: 12:36:36 11:36:36 What I would expect would be the same like date in shell: # date Fri Jul 11 13:37:39 CEST 2003 the correspondent Apache access-log: [11/Jul/2003:12:36:36 +0100] # /sbin/hwclock returns Fri 11 Jul 2003 13:36:42 PM CEST 0.707042 seconds and it could not be set by # /sbin/hwclock --systohc --utc but I think thats not important # ls -l /etc/localtime lrwxrwxrwx 1 root root 33 Jul 11 09:33 /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin which is what I want(my timezone). It's GMT + 1. PHP _has_ these difference of one hour between time() and gmtime(), but both are an extra hour too late. I also restartet Apache, I tried to change /etc/sysconfig/clock, which is now: # cat /etc/sysconfig/clock ZONE="Europe/Berlin" UTC=true ARC=false But PHP did not take care about changes in it, PHP also did not care about changing my timezone, this 1 hour too late stays. also ntpdate did not help, the time was changed about 3 seconds. Im Using RedHat Linux 7.3 min.-Installation I compiled Apache 1.3.27 with PHP 4.3.2 as static module. My PHP-./configure: ./configure --with-apache=../apache_1.3.27 --with-mysql --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-ttf --with-zlib --enable-gd-native-ttf --enable-trans-sid --disable-cgi --enable-ftp I'm using PHP-Accelerator. I have asked a lot of people and searched for people with similar problems, but I did not find any. So my last Idea is that it's a PHP-Bug. Reproduce code: --------------- <?php echo date("H:i:s")."\n"; echo gmdate("H:i:s"); ?> Expected result: ---------------- date: +-0 hours gmdate -1 hour Actual result: -------------- date: -1 hour gmdate -2 hours ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24603&edit=1
