Hi guys,
i run into problems with timezone configuration.
A setup guideline for timezone & timezone settings would be great. (Best practices recommendations)
Following problem in short:
I realised my MYSQL database run in UTC, my local time is “Europe/Berlin”, because of a time difference in database date/time inserts between osticket and other scriptt, i decide to set the timezone for MYSQL also to “Europe/Berlin” - but after i did this, i read (in this forum) that best practice is to hold database data in UTC, also i switched back. BUT after this had still an offset of 1 hour, because OSticket post still the date/time in “Europe/Berlin” instead UTC to the database.
Of course i restarted more times mysql, php and the full server (reboot) - nothing helped out, only to set via “dpkg-reconfigure tzdata” the time zone for the whole server to UTC.
But in my opinion this can’t be correct and wasn’t like before!
Here all details, what my system is and what i changed/progress to this issue i run into:
System:
————————————
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
MYSQL:
mysql Ver 8.0.40-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu))
PHP-FPM:
PHP 8.3.6 (cli) (built: Dec 2 2024 12:36:18) (NTS)
WEBSERVER:
nginx version: nginx/1.24.0 (Ubuntu)
————————————
How explained, after i saw, that my MYSQL Database run with UTC, i guessed it is a good thing to change it to “Europe/Berlin”
After some research i read, that normally with dog-reconfigure tzdata, the mysql-server should also run in the same timezone. What confused me already, because my system had already at this time the date/time of CET = Berlin/Europe, so how you can see, before i run dpkg-reconfigure, i had already CET timezone.
root@:~# date
Fri Jan 3 08:17:50 AM CET 2025
root@:~# dpkg-reconfigure tzdata
Current default time zone: 'Europe/Berlin'
Local time is now: Fri Jan 3 08:18:26 CET 2025.
Universal Time is now: Fri Jan 3 07:18:26 UTC 2025.
root@:~# date
Fri Jan 3 08:18:34 AM CET 2025
After restarting mysql, the Systemconfiguration up following:
![
(i also changed for my php-fpm the date.timzone to “Europe/Berlin”)
But after i realised that isn’t a good idea to run mysql different to UTC, i switched back. I added to my sql configuration:
default-time-zone = +00:00
Also set global timzone to UTC.
Change worked, at this point the Systeminfromation showed me:
The System/OS time was still CET / Europe/Berlin
After this i run in trouble, because the Ticketsystem showed me wrong time. an offset of 1 hour.
I changed also the PHP Date.timezone to UTC, but still the insert/post of osticket happen as CET(Europe/Berlin) for better understanding:
for example:
local time: 10:20:00 CET.
Server time: 10:20:00 CET.
mysql time: 09:20:00 UTC (by select now())
php time: 09:20:00 UTC (by date("h:i:sa");
Post/Insert (mysql database) 10:20:00 ( by osticket still not UTC?)
Post time: (Ticketsystem) 11:20:00 ( defualt timezone/profile in osticket configured as "Europe/Berlin")
Post/insert (mysql database) 09:20:00 (by other script in UTC )
i restarted many times mysql, php-fpm, nginx and so one, nothing changed.
The only fix for me was to set the SYSTEM time with dpkg-reconfigure tzdata to UTC.
So i have 2 questions here:
1) why OSticket ignoring the date.timezone of PHP & database and still posting in local time?
2) what is the normal approach? It’s something new in 2024/2025? That Database, PHP should have same time like System? So everything should run in UTC oder in local time?
Thanks for a guidance here.