[Bug 1069529] [NEW] No graph updates after upgrade to 12.10 because date.timezone not set in php.ini

Launchpad Bug Tracker 1069529 at bugs.launchpad.net
Mon Oct 22 19:07:32 UTC 2012


You have been subscribed to a public bug:

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

According to the FAQ page of cacti, I adjusted the php.ini in /etc/php5/cli and /etc/php5/apache2:
http://docs.cacti.net/faq#time_zone_warning

According to the PHP documentation, the behaviour in PHP 5.4 changed:
http://www.php.net/manual/en/function.date-default-timezone-get.php

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 at 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 at 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 at 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
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 at 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 at 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 at 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:
user at 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://ch.archive.ubuntu.com/ubuntu/ quantal/universe amd64 Packages
        100 /var/lib/dpkg/status
user at 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://ch.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
        100 /var/lib/dpkg/status
user at hostname3:~$ LC_ALL=C apt-cache policy libapache2-mod-php5
libapache2-mod-php5:
  Installed: 5.4.6-1ubuntu1
  Candidate: 5.4.6-1ubuntu1
  Version table:
 *** 5.4.6-1ubuntu1 0
        500 http://ch.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
        100 /var/lib/dpkg/status
user at hostname3:~$

** Affects: php5 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: quantal
-- 
No graph updates after upgrade to 12.10 because date.timezone not set in php.ini
https://bugs.launchpad.net/bugs/1069529
You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to php5 in Ubuntu.



More information about the Ubuntu-server-bugs mailing list