Ad Widget

Collapse

Time zone for PHP is not set (configuration parameter "date.timezone").

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Eithco
    Junior Member
    • Jul 2015
    • 21

    #1

    Time zone for PHP is not set (configuration parameter "date.timezone").

    How do I solve this, from the "Check of Pre-requisites on localhost/zabbix/setup.php?

    I tried setting the timezone in php.ini as suggested here. But no luck.

    I'm running Zabbix on Ubuntu which is running on VirtualBox. Once Ubuntu was installed I followed the instructions here.

    Now I'm trying to get into the GUI and start monitoring. But this timezone issue is blocking me.

    Thank you for your help.
  • neogan
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2011
    • 118

    #2
    Have you tried to change date.timezone parameter in /etc/apache2/conf-available/zabbix.conf which mentioned in installing steps?

    p/s necessary restart apache to apply changes.

    Comment

    • Eithco
      Junior Member
      • Jul 2015
      • 21

      #3
      Are you referring to this document?

      I did modify the parameters as advised there and specifically date.timezone = UTC.

      Restarting apache with this command: /etc/apache2/conf.d/zabbix.conf results in an error message:

      * Restarting web server apache2 /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
      /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
      (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
      no listening sockets available, shutting down

      Using sudo apache does restart, but the php timezone is still 'unknown' and 'fail'.

      Thanks for your help, I truly appreciate it.

      Comment

      • Eithco
        Junior Member
        • Jul 2015
        • 21

        #4
        I guess the relevant line in /etc/php5/apache2/php.ini was commented out. I didn't know that ; in the beginning of a line is a comment.

        I removed it and now the prerequisite works.

        Comment

        • c1support
          Member
          • Apr 2020
          • 47

          #5
          Thank you very much for the hint.

          With Zabbix 4.4.7, when adding the widget "System information" to a dashboard, there was a warning "PHP option "date.timezone" unknown Time zone for PHP is not set (configuration parameter "date.timezone")".
          Apart from that, I did not encounter any other related problems.

          Setting the timezone in /etc/apache2/conf-available/zabbix-frontent-php.conf (followed by sudo service apache2 restart) did not resolve the warning/error.
          After manually setting the date.timezone in /etc/php/7.2/apache2/php.ini (followed by sudo service apache2 restart), the warning disappeared.

          Setting the same value twice gives me kind of a bad feeling.
          => Could anybody please elaborate?
          => Which information is needed to further analyze this behaviour?

          PS: In my case, the parameter in php.ini was in line 937. In nano, line numbers are displayed after ALT + C.
          Last edited by c1support; 19-04-2020, 18:12.

          Comment

          • tim.mooney
            Senior Member
            • Dec 2012
            • 1427

            #6
            It does no harm to set date.timezone twice, but it's also unnecessary duplication.

            Setting it via php_value/php_admin_value in any apache config file is kind of going out of favor, primarily because having PHP as a loadable module is no longer recommended. PHP via a PHP-FPM pool is a more modern way to run PHP. I can understand why the Zabbix docs still mix the php settings in with the Apache settings and default to the loadable module, though. Fewer files to configure and most people are probably familiar with the mod_php method.

            With PHP-FPM, all PHP config is either done at the FPM pool level or via the global PHP config.

            Since the timezone that a system is running in is more of a global property, at my site we typically set timezone globally, not per-pool. To make things easier for our configuration management system to manage PHP config, we typically leave the php.ini file unmodified, putting any global customizations in a numbered conf file in the php.d/ directory. Conf files there are loaded after the php.ini, so settings there can override the stock config file.

            Comment

            Working...