[FAIL] Time between this server and the mysql database is off


I’ve just complete my first install on LibreNMS as I’ve heard so many good things about it. I’m just stuck on the time issue where my MYSQL database seems to be wrong, how do I fix this?

[[email protected] librenms]# ./validate.php
Component | Version
--------- | -------
LibreNMS  | 1.54-5-g267e07e
DB Schema | 2019_07_03_132417_create_mpls_saps_table (139)
PHP       | 7.2.19
MySQL     | 5.5.60-MariaDB
RRDTool   | 1.4.8
SNMP      | NET-SNMP 5.7.2

[OK]    Composer Version: 1.8.6
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[FAIL]  Time between this server and the mysql database is off
 Mysql time 2019-07-31 14:57:15
 PHP time 2019-07-31 22:57:15

[OK]    Database schema correct
[WARN]  You have not added any devices yet.
        You can add a device in the webui or with ./addhost.php
[WARN]  Your local git contains modified files, this could prevent automatic updates.
        You can fix this with ./scripts/github-remove
        Modified Files:


mysql DB is set by your local system time.

You should change your MySQL timezone to UTC, because I’ve heard that PHP7 having trouble with timezone that doesn’t support local time. I’ve experienced like this. PHP7 keep with UTC, while MySQL succeed changed into local time.

and thats why in the installs docs says:

Configure PHP

Ensure date.timezone is set in php.ini to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New_York", "Australia/Brisbane", "Etc/UTC".

I’ve set it in both cli and fpm php.ini, but, it still didn’t changed. So, the solution of mine is change timezone of MySQL to UTC

ok… never had that problem, so i dont know your installation, but php = php
or you changed it whit the quotes, what is not used normaly


I’ve tried it with and without quotes. It still UTC in PHP. So, what should I do to change it into local system time?

and what does your phpinfo(); says? (maybe other overruling ini file?)

I guess run through this?

Pssst, here is an easy change, just dont forget to use your PHP version and Timezone ofcourse

This works for Ubuntu 18 and 19

sudo sed -i "s,;date.timezone =,date.timezone = \"Europe/Amsterdam\",g" /etc/php/7.2/apache2/php.ini
sudo sed -i "s,;date.timezone =,date.timezone = \"Europe/Amsterdam\",g" /etc/php/7.2/cli/php.ini

sudo timedatectl set-timezone Europe/Amsterdam
sudo dpkg-reconfigure -f noninteractive tzdata

sudo mysql -uroot --execute="SET GLOBAL time_zone = 'Europe/Amsterdam';"

sudo systemctl restart apache2
sudo systemctl restart mysql

This will change your timezone on your OS, PHP and MySQL to your timezone.