Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm not sure if this is a question for serverfault or stackoverflow but it seems like it has a lot to do with server config.

We have a server in chicago and the server's clock is on chicago time. But since the business is located in California, it would seem to make sense to use pacific time.

What happens when server time is Chicago, and php.ini directive date.timezone is set to "America/Los_Angeles"? How will that affect logs written to mysql, error logs, etc?

I've looked at the Apache error log and, as I expected, the php directive does not affect it. Times are all servertime.

Thanks.

share|improve this question
add comment

3 Answers

PHP scripts and PHP itself will use Pacific Time, but everything else (including Apache and MySQL) will use the system defined timezone.

share|improve this answer
add comment

Only PHP will use the different timezone.

Since you also asked how this will affect logs written to MySQL (and not by MySQL):
That depends on your application.

If you are logging to MySQL and use MySQL functions (e.g. NOW()) it will use to system timezone.
If you are generating dates via the PHP date() function and write those to MySQL, these would be in the php.ini specified timezone.
And if you are mixing those to store times you obviously have some problems...

I always try to have the same timezone across all applications on one server.

share|improve this answer
    
So, if your server was in Chicago but your business was based in California, would you set the server time to California time? Is there any reason to keep it on Chicago time? –  Buttle Butkus Jun 10 '12 at 23:00
    
I would leave it in Chicago and try to make the App timezone aware/configurable. There are no real technical reasons to put the server into the correct time zone. If you don't, it adds confusion when correlating logs from your ISP with local logs and it must be very clear to anyone working on that server which timezone it is in and why it should stay in there ("I fixed the timezone for you!" and suddenly all nightly cronjobs kick off during the day...). –  faker Jun 10 '12 at 23:28
add comment

It should be added, that php's own error_log (if specified) records in UTC+0, regardless of the date.timezone setting.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.