Having a problem where my date and time aren’t working when doing php.
[FAIL] You have a different system timezone (UTC) than the php configured timezone (EDT)
[FIX] Please correct either your system timezone or your timezone set in php.ini.
But my files look like:
/etc/php/7.0/apache2/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/New_York"
/etc/php/7.0/cli/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/New_York"
root@x1:/opt/librenms# date
Thu Sep 20 10:16:36 CEST 2018
root@x:/opt/librenms# cat /etc/timezone
Europe/Warsaw
root@x:/opt/librenms# grep -R “timezone” /etc/php/7.2/apache2/php.ini
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Warsaw
root@x:/opt/librenms# grep -R “timezone” /etc/php/7.2/cli/php.ini
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Warsaw
root@x:/opt/librenms#
Time on alerts is being displayed in UTC (2 hours earlier) even though PHP time is set to UTC+2 (Warsaw)
phpinfo();
System
Linux xx 4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 x86_64
root@xx:/opt/librenms# dpkg -l | grep -i php
ii composer 1.6.3-1 all dependency manager for PHP
ii libapache2-mod-php7.2 7.2.10-0ubuntu0.18.04.1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-cli-prompt 1.0.3+dfsg-1 all tiny helper prompting for user input
ii php-common 1:60ubuntu1 all Common files for PHP packages
ii php-composer-ca-bundle 1.1.0-1 all utility library to find a path to the system CA bundle
ii php-composer-semver 1.4.2-1 all utilities, version constraint parsing and validation
ii php-composer-spdx-licenses 1.3.0-1 all SPDX licenses list and validation library
ii php-json-schema 5.2.6-1 all implementation of JSON schema
ii php-psr-log 1.0.2-1 all common interface for logging libraries
ii php-symfony-console 3.4.6+dfsg-1ubuntu0.1 all run tasks from the command line
ii php-symfony-debug 3.4.6+dfsg-1ubuntu0.1 all tools to make debugging of PHP code easier
ii php-symfony-filesystem 3.4.6+dfsg-1ubuntu0.1 all basic filesystem utilities
ii php-symfony-finder 3.4.6+dfsg-1ubuntu0.1 all find files and directories
ii php-symfony-polyfill-mbstring 1.6.0-2 all Symfony polyfill for the Mbstring extension
ii php-symfony-process 3.4.6+dfsg-1ubuntu0.1 all execute commands in sub-processes
ii php7.2-cli 7.2.10-0ubuntu0.18.04.1 amd64 command-line interpreter for the PHP scripting language
ii php7.2-common 7.2.10-0ubuntu0.18.04.1 amd64 documentation, examples and common module for PHP
ii php7.2-curl 7.2.10-0ubuntu0.18.04.1 amd64 CURL module for PHP
ii php7.2-gd 7.2.10-0ubuntu0.18.04.1 amd64 GD module for PHP
ii php7.2-json 7.2.10-0ubuntu0.18.04.1 amd64 JSON module for PHP
ii php7.2-mbstring 7.2.10-0ubuntu0.18.04.1 amd64 MBSTRING module for PHP
ii php7.2-mysql 7.2.10-0ubuntu0.18.04.1 amd64 MySQL module for PHP
ii php7.2-opcache 7.2.10-0ubuntu0.18.04.1 amd64 Zend OpCache module for PHP
ii php7.2-readline 7.2.10-0ubuntu0.18.04.1 amd64 readline module for PHP
ii php7.2-snmp 7.2.10-0ubuntu0.18.04.1 amd64 SNMP module for PHP
ii php7.2-xml 7.2.10-0ubuntu0.18.04.1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.2-zip 7.2.10-0ubuntu0.18.04.1 amd64 Zip module for PHP
root@xx:/opt/librenms# ./validate.php
Component
Version
LibreNMS
1.43-100-gfc12175ee
DB Schema
267
PHP
7.2.10-0ubuntu0.18.04.1
MySQL
10.1.34-MariaDB-0ubuntu0.18.04.1
RRDTool
1.7.0
SNMP
NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.7.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX] You can fix this with ./scripts/github-remove
Modified Files:
bootstrap/cache/.gitignore
includes/functions.php
storage/app/.gitignore
storage/app/public/.gitignore
storage/debugbar/.gitignore
storage/framework/cache/.gitignore
storage/framework/sessions/.gitignore
storage/framework/testing/.gitignore
storage/framework/views/.gitignore
storage/logs/.gitignore
cat config.php
<?php
## Have a look in defaults.inc.php for examples of settings you can set here. DO NOT EDIT defaults.inc.php!
### Database config
$config['db_host'] = 'localhost';
$config['db_port'] = '3306';
$config['db_user'] = 'librenms';
$config['db_pass'] = 'XXXXXX';
$config['db_name'] = 'librenms';
$config['db_socket'] = '';
// This is the user LibreNMS will run as
//Please ensure this user is created and has the correct permissions to your install
$config['user'] = 'librenms';
### Locations - it is recommended to keep the default
#$config['install_dir'] = "/opt/librenms";
### This should *only* be set if you want to *force* a particular hostname/port
### It will prevent the web interface being usable form any other hostname
#$config['base_url'] = "http://librenms.company.com";
### Enable this to use rrdcached. Be sure rrd_dir is within the rrdcached dir
### and that your web server has permission to talk to rrdcached.
#$config['rrdcached'] = "unix:/var/run/rrdcached.sock";
### Default community
$config['snmp']['community'] = array("public");
### Authentication Model
$config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth
#$config['http_auth_guest'] = "guest"; # remember to configure this user if you use http-auth
### List of RFC1918 networks to allow scanning-based discovery
#$config['nets'][] = "10.0.0.0/8";
#$config['nets'][] = "172.16.0.0/12";
#$config['nets'][] = "192.168.0.0/16";
# Update configuration
#$config['update_channel'] = 'release'; # uncomment to follow the monthly release channel
#$config['update'] = 0; # uncomment to completely disable updates
Any ideas guys? It’s a fresh install of ubuntu 18.04, time on the server is fine so I don’t know where is this coming from.
I dont’ know what else I can check.
So, when I was checking your
select now();
it was wrong, I tried putting the config option to various files but mysql daemon always failed to start so in the end I didn’t add default-time-zone to sql settings.
What’s interesting, now it works and I am unsure what helped here.
I reverted config/app.php, rebooted the whole server and it is still working.