The timestamps in my PHP error log are being displayed in UTC. I want them to display in my local timezone.

  • The date.timezone property in my php.ini file is set to the correct timezone.
  • The output of phpinfo() displays the correct timezone.
  • The output of phpinfo() states that the correct php.ini file is loaded.
  • The server's clock is set to the correct timezone.

All of the websites I've found with Google just say to check those three things.

I'm using Windows Server 2019 and IIS.

Here is an example of what one of the lines in the log file currently looks like:

[28-Dec-2018 14:22:39 UTC] PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\path\media.php on line 694

Update: If I run a PHP script from the command line, and that script generates an error, the log entry DOES have a timestamp in my local timezone.

  • 1
    This MS support link has some info about why IIS might do this, and some solutions.The selected log file format is the W3C Extended Log File Format [which] defines the Date and Time files to always be in GMT. This behavior is by design. These solutions appear to be related to IIS logs themselves, so I'm not sure if this would also effect PHP logs, but may be worth checking:
    – v25
    Dec 28, 2018 at 1:48
  • 1
    PHP does not log. The webserver does, so the webserver config applies, not the php config. Dec 28, 2018 at 6:17

2 Answers 2


As per my comment, it sounds like your webserver is using the default log file format (W3C Extended) which uses GMT by default. The MS support page I linked contains two solutions for this.

The temporary solution is to run the following command on your log files:

c:\windows\system32\convlog -ie LogFileName -t ncsa:+/-GMTOffset

where LogFileName is the name of the file to convert and GMTOffset is the number of hours to correct. (for example -0500 for EST). NOTE: This solution does not actually change the time stamps for the log entries. It enters the GMT offset into each entry, so that anyone reading through the log can see that the time stamp is not in local time.

The following is an example of a log entry produced by this utility: - - [30/Jun/2000:20:16:40 -0500] "GET /default.asp HTTP/1.0" 200

The best solution, it would seem, is to change the log file format to IIS log file format. I found the following guide in which Step 4 tells you how to do this:


This applies to Windows Server 2012, and Windows 8, but may be similar for your version. Please note the change can be applied at separate levels: Site, Per Site (Server), Per Server (Server).

  • Thanks for the answer @v25. I'm not worried about the IIS logs. It's the PHP logs that I want to change. I'm pretty sure this log file is outside the control of IIS, but I could be wrong. I added an example of what one of the lines in the log file looks like.
    – Michael
    Dec 28, 2018 at 14:23
  • If Gerald who commented directly to your question is correct, then PHP logs are created by the webserver process so these settings would apply to both.
    – v25
    Dec 28, 2018 at 14:27
  • Changing the log file format to "IIS" did indeed change the timestamps of my IIS logs to use my local timezone. But it had no effect on my PHP logs. I also tried running the iisreset command, but it had no effect either. Ugh.
    – Michael
    Dec 28, 2018 at 14:33
  • this article suggets that there may be multiple date.timezone lines in your PHP.ini file, one added by the windows installer near the end under [WebPIChanges]. The last is accepted; so may be worth checking this also.
    – v25
    Dec 28, 2018 at 14:38
  • Thanks for your help. Nope, my php.ini only has a single date.timezone line. Just noticed that it's logging warning-level errors, even though I told it not to. I wonder if it's using some kind of cached version of my php.ini file?
    – Michael
    Dec 28, 2018 at 14:43

Issue could be related to a generic WordPress file of the name:


That file uses a miserable PHP function, of the name: gmdate()

That functions uses UTC…

I have replaced it with the echo date('Y-m-d H:i:s'); function (around line 928), and also placed directive: date_default_timezone_set('Myontinenet/MyCountry'); on the beginning of the file.

This seems to have solved the PHP error log, not logging current time, but UTC time.

I have found the problem by searching for the usage of the stringerror_log( on all my domain files. That is because this is the PHP function that logs error logs, and those wrong error log, came from somewhere….

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .