Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Incorrect timezone set in php.ini

    Scheduled Pinned Locked Moved 2.3.1 Snapshots Testing and Feedback - ARCHIVED
    4 Posts 3 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      GoldServe
      last edited by

      It seems like my /usr/local/etc/php.ini has this line set

      date.timezone="Etc/UTC"
      

      when clearly /etc/rc.php_ini_setup contains the following code:

      unset TIMEZONE
      # Fetch the timezone from /var/db/zoneinfo if present
      if [ -f /var/db/zoneinfo ]; then
      	TIMEZONE=$(cat /var/db/zoneinfo)
      fi
      
      if [ -z "${TIMEZONE}" ]; then
      	# Second option is from config.xml
      	TIMEZONE=$(/usr/local/sbin/read_xml_tag.sh string system/timezone)
      fi
      
      if [ -z "${TIMEZONE}" ]; then
      	# Last option, use default value from $g or Etc/UTC
      	TIMEZONE=$(/usr/local/sbin/read_global_var default_timezone "Etc/UTC")
      fi
      

      Anyone spot anything wrong? I verified the timezone is correct by running the script /usr/local/sbin/read_xml_tag.sh string system/timezone

      1 Reply Last reply Reply Quote 0
      • jdillardJ
        jdillard
        last edited by

        Out of curiosity, is your timezone in System > General Setup set to Etc/UTC?

        1 Reply Last reply Reply Quote 0
        • G
          GoldServe
          last edited by

          No, running root: /usr/local/sbin/read_xml_tag.sh string system/timezone gives me:

          America/Vancouver
          
          1 Reply Last reply Reply Quote 0
          • C
            cmb
            last edited by

            Did you reboot after changing the timezone from UTC? Guessing not, some things will be on the old timezone until a reboot, php.ini among those. If I set my tz to America/Vancouver, and either reboot or run rc.php_ini_setup, I correctly get:

            : grep timez /usr/local/etc/php.ini
            date.timezone="America/Vancouver"
            
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.