DataBase said FAIL: Time between this server and the mysql database is off Mysql time 2023-12-06 08:43:51 PHP time 2023-12-06 13:43:51

Hi! I am trying to setup librenms but I am getting an error in the database and php both involving timezones but I have made sure that all timezones are right and none of them are different. What is down below is to show that all my timezones are set correctly. Do you guys have any ideas?

The exact two errors I’m getting are in the database and it says “Fail: Time between this server and the mysql database is off Mysql time 2023-12-06 08:43:51 PHP time 2023-12-06 13:43:51”

The PHP error is “FAIL: You have no timezone set for php.”

echo “LOCAL_SYTEM” && date && echo && echo “MYSQL” && mysql -ulibrenms -PASSWORD --execute=“SELECT NOW(); SELECT @@global.time_zone;” librenms && echo && echo “PHP” && php -r ‘print_r(date_default_timezone_get());’ && echo&& php -r ‘echo date(“m/d/Y h:i:s a”, time());’ && echo
LOCAL_SYTEM
Wed Dec 6 08:52:15 AM EST 2023

MYSQL
±--------------------+
| NOW() |
±--------------------+
| 2023-12-06 08:52:15 |
±--------------------+
±-------------------+
| @@global.time_zone |
±-------------------+
| -05:00 |
±-------------------+

PHP
America/New_York
12/06/2023 08:52:15 am

Update; I did a ./validate.php in the cli and everything came back perfectly fine but on the web server it says otherwise.

You need to set the timezone in the php cli configuration file and the php fpm configuration file?

1 Like

Hi @Trevor_Innarelli You must configure your PHP using “America/New_York” (for example) as timezone

If you have UBUNTU you edit

vi /etc/php/8.1/fpm/php.ini
vi /etc/php/8.1/cli/php.ini

If you have Centos you edit

vi /etc/php.ini

And then for the system

timedatectl set-timezone America/New_York

Timezone value source:
https://php.net/manual/en/timezones.php

I did it like this and it works for me

I hope it helps you :+1:

Greetings

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.