awpti Posted October 17, 2009 Share Posted October 17, 2009 So, here's my issue: Server time: [20:02:12] [awpti@GeekFDC ~]: date Fri Oct 16 20:02:14 MST 2009 PHP Says it is: October 16, 2009 21:02:14 TZ in php.iin = America/Phoenix I am completely stumped. Why is PHP Reporting a different time? To top it off, when using php on the command line, it reports the same time as the server. WTFMate? -G Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 17, 2009 Share Posted October 17, 2009 Because Arizona does not observe DST. Quote Link to comment Share on other sites More sharing options...
awpti Posted October 17, 2009 Author Share Posted October 17, 2009 This I know, however.. Apache's TZ env = America/Phoenix MySQL is reporting the correct time since the server's timezone is also set to MST. It makes no sense that PHP -through- apache is reporting the wrong time. I can even force the OS date/time to an hour earlier to "make up" for the difference and it STILL reports 21:00:00 instead of, say, 20:00:00 This is making a small tool I'm trying to develop impossible to complete. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 17, 2009 Share Posted October 17, 2009 The php CLI is not going to use the same php.ini that php running under the web server is using unless you tell the CLI to use the php.ini that the web server is. Mysql also has its' own time zone setting. Changing the OS time setting is not necessarily going to affect php unless you restart the web server. It sounds like what ever you are doing, you should be using GMT or you should not be doing a conversion (such as what a Unix Timeseamp must under go's to display it in a human readable form) that is dependent on the time zone setting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.