I noticed that the xdebug log time is always two hours too early. For example it says the log is created at 7:15 am even though it is 9:15 am.

If I execute date in my terminal, then I get 9:15 am

  • Is this the php xdebug? Is it running with a different time zone, by any chance? What is the full date output?
    – Jeff Schaller
    Aug 1, 2019 at 10:46
  • @JeffSchaller, no I build it from source, but I also tried it with php7-xdebug and here it is the same. The full output of date is currently Thu Aug 1 15:13:26 CEST 2019
    – Black
    Aug 1, 2019 at 13:13
  • Both date outputs...
    – Jeff Schaller
    Aug 1, 2019 at 13:50
  • The other date is 2 hours too earlie as I said.. so it is 13:13:16
    – Black
    Aug 2, 2019 at 7:21
  • Is the log in UTC/GMT, though?
    – Jeff Schaller
    Aug 2, 2019 at 9:55

2 Answers 2


Based on your comment regarding the current time being Thu Aug 1 15:13:26 CEST 2019, my theory is that the xdebug log is running (or logging) in UTC, which is two hours earlier than CEST. It's unfortunate that the timezone doesn't appear to be part of the output; that leaves the actual time ambiguous for any cross-referencing, as you've seen.

I found a Stack Overflow post that mentions setting the date.timezone value to your desired timezone. It also says:

It is always better to load xdebug extension at the end of file(php.ini).

The list of php.ini directives indicates that the default value for date.timezone is empty, which presumably falls back to UTC.

My suggestion, since CEST is not a valid value, would be to pick your region from this list of valid PHP European timezones (or Antarctica or Africa, as appropriate). For more, see the full list of timezones supported by PHP.

  • xdebug was indeed at the start of the php.ini. I placed it at the end and restarted apache2, but it makes no difference. The wrong timezone must be hardcoded in the xdebug module? I have also set date.timezone to Europe/Berlin, it was CET. I talked to the main developer Derik once, he said that xdebug is set to use UTC, but did not asked if I can change it back then...
    – Black
    Aug 8, 2019 at 6:43

I couldn't get this to work, even with my date.timezone set in php.ini and xdebug.ini loaded afterwards.

My Xdebug log (no longer called "remote log" in Xdebug 3) was still showing UTC time. I couldn't find any way to change this other than by editing the Xdebug source and recompiling. I don't see anything in the source code for Xdebug that would convert time to local time, so maybe this is the only way.

See my stackoverflow answer to my own question for more details. But here's the gist.

All I had to do was change gmtime() to localtime() in src/lib/timing.c function char* xdebug_nanotime_to_chars around line 196.

And that works, but I wanted the timezone code printed in the log.

To do that, I had to make a few more changes. I made a function to return the timezone string, then added that function into the log open/close functions in the same file (src/lib/log.c).

You must log in to answer this question.

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