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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.