Search code examples
phpmacosdebuggingsyslog

Different timestamp on php_error.log


I'm using MAMP on a MacBook Pro, and whenever I took a look into the php_error.log I get each error with a timestap from Berlin but I'm in South America.

[16-Jan-2016 03:06:40 Europe/Berlin] PHP Parse error:

The actual time when that error happened was 21:06.

how can I change this timestamp? I know is not a big deal but is easier to debug when the date is correct.


Solution

  • The timezone is indeed set to Berlin somewhere in your system or code.

    1. Check /usr/local/etc/php/(version)/php.ini file and look for date.timezone setting. A full list of supported timezones is available here. Modify this setting if necessary and restart your PHP process/server. Even if the setting was not present, it's a good idea to fix that now!

    2. Check if 'Europe/Berlin' is set somewhere in your code. Simple way to look in all PHP files in the folder:

    find . -name "*.php" -exec grep -H "Europe/Berlin" {} \;