After release upgrading from 12.04 to 12.10, I remarked that the graphs are not updated anymore and the modify date of the files in /var/lib/cacti/rra was a timestamp before the upgrade.
I had many lines in /var/log/cacti/poller-error.log like this one:
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/cacti/site/lib/functions.php on line 486
First I thought that it is a bug of the packages php5-cli and libapache2-mod-php5 which do not set the date.timezone in their respective php.ini files. You can see that if you execute the following 2 commands:
dpkg-query --control-show libapache2-mod-php5 postinst
dpkg-query --control-show php5-cli postinst
There is only the default php.ini from the package copied without setting the date.timezone variable or let the user choose one.
But then I recognized, that the PHP script is executed to the end, also if the date.timezone variable is not set in php.ini
Let me demonstrate this in 3 examples:
1) Ubuntu 11.10 with timezone Europe/Zurich in /etc/timezone, no date.timezone set in php.ini and PHP version 5.3.6-13ubuntu3.9:
PHP Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
5.4.6-1ubuntu1
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
Sun, 21 Oct 2012 19:33:45 +0000
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
1350848025
all commands executed with success
user@hostname2:~$
2) Ubuntu 12.10 with timezone Europe/Zurich in /etc/timezone, date.timezone set in php.ini to Europe/Zurich and PHP version 5.4.6-1ubuntu1:
Europe/Zurich
5.4.6-1ubuntu1
Sun, 21 Oct 2012 21:35:16 +0200
1350848116
all commands executed with success
user@hostname3:~$
I am really not sure whether this is a bug in cacti (because the graphs are not updated although the not set timezone in php.ini should let the poller finish his work) or in php5-cli/libapache2-mod-php5 (which should either interact with the user to ask which timezone to set in the php.ini or take the timezone from /etc/timezone), I just recognized that the graphs in cacti did not update after the release upgrade and it worked again after setting date.timezone in both php.ini files and reloading apache2.
IMHO it has to be solved either in the cacti package or the bug should be assigned to php5-cli and libapache2-mod-php5 to let them set the date.timezone variable in the postinstall routine.
After release upgrading from 12.04 to 12.10, I remarked that the graphs are not updated anymore and the modify date of the files in /var/lib/cacti/rra was a timestamp before the upgrade.
I had many lines in /var/log/ cacti/poller- error.log like this one: timezone_ set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/ cacti/site/ lib/functions. php on line 486
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_
According to the FAQ page of cacti, I adjusted the php.ini in /etc/php5/cli and /etc/php5/apache2: docs.cacti. net/faq# time_zone_ warning
http://
According to the PHP documentation, the behaviour in PHP 5.4 changed: www.php. net/manual/ en/function. date-default- timezone- get.php
http://
First I thought that it is a bug of the packages php5-cli and libapache2-mod-php5 which do not set the date.timezone in their respective php.ini files. You can see that if you execute the following 2 commands:
dpkg-query --control-show libapache2-mod-php5 postinst
dpkg-query --control-show php5-cli postinst
There is only the default php.ini from the package copied without setting the date.timezone variable or let the user choose one.
But then I recognized, that the PHP script is executed to the end, also if the date.timezone variable is not set in php.ini
Let me demonstrate this in 3 examples:
1) Ubuntu 11.10 with timezone Europe/Zurich in /etc/timezone, no date.timezone set in php.ini and PHP version 5.3.6-13ubuntu3.9:
user@hostname1:~$ echo; lsb_release -a; echo; uname -a; echo; cat /etc/timezone; echo; grep "date\.timezone" /etc/php5/ cli/php. ini; echo; php -r 'echo date_default_ timezone_ get()." \n"; echo phpversion()."\n"; echo date("r")."\n"; echo strtotime( "now"). "\n"; echo "\nall commands executed with success\n\n";'
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric
Linux hostname1 2.6.32-042stab061.2 #1 SMP Fri Aug 24 09:07:21 MSK 2012 i686 i686 i386 GNU/Linux
Europe/Zurich
; http:// php.net/ date.timezone
;date.timezone =
Europe/Berlin
5.3.6-13ubuntu3.9
Sun, 21 Oct 2012 22:21:12 +0200
1350850872
all commands executed with success
user@hostname1:~$
2) Ubuntu 12.10 with timezone Europe/Zurich in /etc/timezone, no date.timezone set in php.ini and PHP version 5.4.6-1ubuntu1:
user@hostname2:~$ echo; lsb_release -a; echo; uname -a; echo; cat /etc/timezone; echo; grep "date\.timezone" /etc/php5/ cli/php. ini; echo; php -r 'echo date_default_ timezone_ get()." \n"; echo phpversion()."\n"; echo date("r")."\n"; echo strtotime( "now"). "\n"; echo "\nall commands executed with success\n\n";'
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
Linux hostname2 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Europe/Zurich
; http:// php.net/ date.timezone
;date.timezone =
PHP Warning: date_default_ timezone_ get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_ timezone_ set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1 timezone_ set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1 timezone_ set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
5.4.6-1ubuntu1
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_
Sun, 21 Oct 2012 19:33:45 +0000
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_
1350848025
all commands executed with success
user@hostname2:~$
2) Ubuntu 12.10 with timezone Europe/Zurich in /etc/timezone, date.timezone set in php.ini to Europe/Zurich and PHP version 5.4.6-1ubuntu1:
user@hostname3:~$ echo; lsb_release -a; echo; uname -a; echo; cat /etc/timezone; echo; grep "date\.timezone" /etc/php5/ cli/php. ini; echo; php -r 'echo date_default_ timezone_ get()." \n"; echo phpversion()."\n"; echo date("r")."\n"; echo strtotime( "now"). "\n"; echo "\nall commands executed with success\n\n";'
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
Linux hostname3 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Europe/Zurich
; http:// php.net/ date.timezone
date.timezone = "Europe/Zurich"
Europe/Zurich
5.4.6-1ubuntu1
Sun, 21 Oct 2012 21:35:16 +0200
1350848116
all commands executed with success
user@hostname3:~$
I am really not sure whether this is a bug in cacti (because the graphs are not updated although the not set timezone in php.ini should let the poller finish his work) or in php5-cli/ libapache2- mod-php5 (which should either interact with the user to ask which timezone to set in the php.ini or take the timezone from /etc/timezone), I just recognized that the graphs in cacti did not update after the release upgrade and it worked again after setting date.timezone in both php.ini files and reloading apache2.
IMHO it has to be solved either in the cacti package or the bug should be assigned to php5-cli and libapache2-mod-php5 to let them set the date.timezone variable in the postinstall routine.
package versions: ch.archive. ubuntu. com/ubuntu/ quantal/universe amd64 Packages dpkg/status ch.archive. ubuntu. com/ubuntu/ quantal/main amd64 Packages dpkg/status mod-php5: ch.archive. ubuntu. com/ubuntu/ quantal/main amd64 Packages dpkg/status
user@hostname3:~$ LC_ALL=C apt-cache policy cacti
cacti:
Installed: 0.8.8a-3
Candidate: 0.8.8a-3
Version table:
*** 0.8.8a-3 0
500 http://
100 /var/lib/
user@hostname3:~$ LC_ALL=C apt-cache policy php5-cli
php5-cli:
Installed: 5.4.6-1ubuntu1
Candidate: 5.4.6-1ubuntu1
Version table:
*** 5.4.6-1ubuntu1 0
500 http://
100 /var/lib/
user@hostname3:~$ LC_ALL=C apt-cache policy libapache2-mod-php5
libapache2-
Installed: 5.4.6-1ubuntu1
Candidate: 5.4.6-1ubuntu1
Version table:
*** 5.4.6-1ubuntu1 0
500 http://
100 /var/lib/
user@hostname3:~$