Change timezone to Apache server , PHP and MySql in XAMPP

less than 1 minute read

I have installed XAMPP in my Windows machine and I want to alter the timezone in Apache HTTP server, PHP module and MySql in order to see proper dates in server error.log, access.log and php_error_log output.

After some searching I found the solution:

  1. In httpd.conf (\xampp\apache\conf\httpd.conf) , add the following line:
    # Set timezone to Europe/Athens UTC+02:00
    SetEnv TZ Europe/Athens
    
  2. Edit php.ini (\xampp\php\php.ini) date.timezone value in [Date] section:
    date.timezone = "Europe/Athens"
    

    You can find the available PHP timezones in http://php.net/date.timezone

  3. In my.ini (\xampp\mysql\bin\my.ini) add or replace
    default-time-zone = "Europe/Athens"
    

Now restart Apache HTTP and MySQL server and you are done!

Leave a Comment