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

    Can we add date.timezone to php.ini?

    Scheduled Pinned Locked Moved 2.1 Snapshot Feedback and Problems - RETIRED
    14 Posts 4 Posters 5.1k 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.
    • jimpJ Offline
      jimp Rebel Alliance Developer Netgate
      last edited by

      Looks like we went the other way with it:

      $ grep -nr "timezone_set" *
      etc/inc/config.inc:215:date_default_timezone_set("$timezone");
      usr/local/www/guiconfig.inc:1120:date_default_timezone_set($timezone);
      usr/local/www/pkg_mgr_installed.php:47:date_default_timezone_set($timezone);
      usr/local/www/pkg_mgr.php:51:date_default_timezone_set($timezone);
      

      I don't recall the exact reason we did that rather than using php.ini, perhaps it made php pick it up faster and didn't require restarting lighttpd/php

      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      1 Reply Last reply Reply Quote 0
      • C Offline
        Cino
        last edited by

        thanks for the quick reply… I changed my code back and just added "date_default_timezone_set("EST5EDT");" into vnstat.php for now(cleaner and doesn't touch the core)... I tried to include/require_once("guiconfig.inc"); but it kicked out errors for that file...

        1 Reply Last reply Reply Quote 0
        • johnpozJ Offline
          johnpoz LAYER 8 Global Moderator
          last edited by

          So you have it up and running then?  Looking forward to your writeup on getting it working again.

          Then what do we have to do to get the package updated, etc. ;)

          edit: I just went to go put in the timezone stuff - and my vnstat is back to before.
          Function split() is deprecated in /usr/local/www/vnstat2/vnstat.php on line 130

          I updated to new snap this morning to see if that fixed the upnp errors I was seeing in the log.  I really want to get 1.5.1 vs the 1.4.1 but keep the formatting that was there in the package.  But the code from 1.5.1 points to themes folder and locale, etc.

          Hope I can find some time at work today to play with it.  Maybe your writeup will be available this afternoon?

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 25.07.1 | Lab VMs 2.8.1, 25.07.1

          1 Reply Last reply Reply Quote 0
          • C Offline
            Cino
            last edited by

            not sure when i'm going to get it done.. haven't started yet… :-(

            on line 130, change split to explode

            1 Reply Last reply Reply Quote 0
            • johnpozJ Offline
              johnpoz LAYER 8 Global Moderator
              last edited by

              I know how to fix that portion ;)  Version 1.5.1 of phpfrontend already has that change in place.

              I think we are about in the same place - I had gotten to the Warning: strftime() yesterday but ran out of play time ;) to move forward with it.

              From the commit history for the package
              https://github.com/bsdperimeter/pfsense-packages/commits/master/config/vnstat2

              Looks like perry mason is the dev for the package, but has not made a commit for like 8 months.  Maybe we can just submit the right changes for the package?

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 25.07.1 | Lab VMs 2.8.1, 25.07.1

              1 Reply Last reply Reply Quote 0
              • jimpJ Offline
                jimp Rebel Alliance Developer Netgate
                last edited by

                If you can make it work, and others confirm your fixes work, submit a pull request and I'll approve it.

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • C Offline
                  Cino
                  last edited by

                  I got 1.5.1 to work after some hacking… I'll have to see what needs to be changed from the package itself to make sure it creates the db and the config.php page... Biggest issue I see, this package downloads the frontend.. Its not in the package itself... Which isn't a big deal I guess, we would just have to overwrite/add some files to it. The theme was built into the config.php page in the past, now it has its own folder. And for the life of me, can't figure how to add date_default_timezone_set("$timezone").. hate to have it as a manual hack..

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    phil.davis
                    last edited by

                    The code for the front end is all bundled up in http://www.pfsense.com/packages/config/vnstat2/bin/vnstat_php_frontend-1.4.1.tar.gz
                    On the vnstat GUI, when you "Enable vnstat php frontend" then it unpacks this tar and suddenly you have files in /usr/local/www/vnstat2 - like vnstat.php
                    I suppose that each time you press save it unpacks the tar again, overwriting whatever edits you made to vnstat.php
                    The problem is that this code is not in the repository. It is a kind of standard distribution of vnstat scripts and stuff. So the scripts would need to be fixed to work with the latest PHP version then make another tar, or find where this came from and get an updated tar that has scripts that work with the current PHP.
                    And I am guessing that it runs somewhat standalone, not integrated into the pfSense menu tree. So it probably won't understand $timezone.
                    Someone will need to do a bit of research to sort out the best way to proceed with this.

                    As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                    If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                    1 Reply Last reply Reply Quote 0
                    • johnpozJ Offline
                      johnpoz LAYER 8 Global Moderator
                      last edited by

                      Well that frontend is not the actual tar.gz from original site, its been modified to contain the pfsense.css, etc.

                      You can grab the 1.5.1 tar.gz for the original website here.
                      http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz

                      You can grab the original 1.4.1 here
                      http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz

                      Cino, can you post your hacks to get 1.5.1 working - thanks!

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 25.07.1 | Lab VMs 2.8.1, 25.07.1

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        Cino
                        last edited by

                        @johnpoz:

                        Cino, can you post your hacks to get 1.5.1 working - thanks!

                        let me know how you make out
                        http://forum.pfsense.org/index.php/topic,47241.msg274510.html#msg274510

                        we kinda went off topic a lot so i posted the how-to on your old post

                        1 Reply Last reply Reply Quote 0
                        • jimpJ Offline
                          jimp Rebel Alliance Developer Netgate
                          last edited by

                          Looks like the reason we went this way is that the php.ini setup script is a shell script (by necessity) and it doesn't have any knowledge of the timezone in the config.xml file.

                          It could probably be done, we have other shell scripts that use some shell-fu to grep/awk out values from the config, it's not just a quick/easy fix.

                          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                          Need help fast? Netgate Global Support!

                          Do not Chat/PM for help!

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            Cino
                            last edited by

                            thanks jimp… I had a feeling that could be the case :-(  I figured out how to get vnstat2 to work for now.... I really need to learn how to program php...lol

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.