Jump to content

Retarded question, can't find an answer (server time vs what php says it is)


awpti

Recommended Posts

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.