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.
PHP scripts and PHP itself will use Pacific Time, but everything else (including Apache and MySQL) will use the system defined timezone.
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.
It should be added, that php's own
error_log
(if specified) records inUTC+0
, regardless of thedate.timezone
setting.