Change timezone to Apache server , PHP and MySql in XAMPP

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

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!


About cmanios

This entry was posted in Apache, Databases, HTTP, mysql, PHP and tagged , , , , , , , , , , , . Bookmark the permalink.

8 Responses to Change timezone to Apache server , PHP and MySql in XAMPP

  1. Manthan Rana says:

    Great post. Thanks..!

  2. VIjay says:


  3. Very well explained! Simple and clear!

  4. I have a question : How do I configure in Xampp for setlocale ( LC_ALL , ” es_ES ” ) ?

  5. fl2tx&co says:

    The change to my.ini crashes the server with: Fatal error: Illegal or unknown default time zone ‘Europe/Athens’

  6. zygd says:

    did not work……. phpinfo() tells me that date.timezone is still incorrect, and date() shows incorrect time. DateTime() is again incorrect and same with date_default_timezone_get(). I am on Windows 7 , XAMPP, PHP 7.1, MariaDB 10.2.3.

    • zygd says:

      My apologies, it was my mistake, as in php.ini file, I inserted the line for a new timezone, but did not notice that below that was another line, setting the timezone to another.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s