We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54066
    • 3 Posts
    Hello!
    I attempted first to install MODX into my root (public_html) directory where currently there resides two folders. Each being SUB domains. No files in the root folder but one htaccess that is a simple php version directive created by the versions manager in my controlpanel. I made it write-able to MODX thinking that this would avoid errors after installation.
    Moving forward.
    After the initial setup of which went flawlessly, I landed on the administrator login page. When I successfully logged in, I was immediatley hit with the following error and a dead application:

    Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (CST6CDT) at position 3 (6): Unexpected character in /home/username/public_html/manager/controllers/default/dashboard/widget.grid-online.php:17 Stack trace: #0 /home/username/public_html/manager/controllers/default/dashboard/widget.grid-online.php(17): DateTime->__construct('CST6CDT') #1 /home/username/public_html/core/model/modx/moddashboardwidget.class.php(246): modDashboardWidgetWhoIsOnline->render() #2 /home/username/public_html/core/model/modx/moddashboardwidget.class.php(118): modDashboardWidgetInterface->process() #3 /home/username/public_html/core/model/modx/moddashboard.class.php(78): modDashboardWidget->getContent(Object(WelcomeManagerController)) #4 /home/username/public_html/manager/controllers/default/welcome.class.php(64): modDashboard->render(Object(WelcomeManagerController)) #5 /home/username/public_html/core/model/modx/modmanagercontroller.class.php(149): WelcomeManagerController->process(Array) #6 /home/username/public_ in /home/username/public_html/manager/controllers/default/dashboard/widget.grid-online.php on line 17


    * @version MODX 2.6.1
    * @version PHP7.0
    * @version MySQL cpsrvd 11.66.0.23
    * Database client version: libmysql - 5.1.73
    * PHP extension: mysqli Documentation curl Documentation mbstring Documentation
    * PHP version: 5.6.30
    ==================================================================================
    I should point out above that the default PHP version on my host is 5 and that I changed the version
    for my public_html folder to PHP7 because PHP threw the same error when I attempted to install with PHP5 running. Additionally, The same error was spat at me when I installed to my local NIX machine.

    And here I am after attempting to trace the stack back to the script that set the DATETIME constant
    thinking that maybe I could tweek things a little in order to get past it. However that's when I decided to come here first. Hope I have provided enough information to get this corrected because I would much prefer to use MODX over the others. Thank you everyone!

    This question has been answered by multiple community members. See the first response.

      • 3749
      • 24,544 Posts
      That line is expecting a date/timezone in the form "Europe/Paris".

      It tries to get the date_timezone System Setting in the modx_system_settings table in the DB. If it's empty, it used PHP's date_default_timezone_get(), which is unreliable.

      Probably the best solution would be to go into the database, find the date_timezone System Setting in the modx_system_settings table, and set it to one of the values here: http://php.net/manual/en/timezones.php.

      Manually delete all files in the core/cache directory after fixing the DB setting before trying to log in.

      You should also look for that incorrect date/timezone setting in any php.ini files or .htaccess file at the MODX root directory or above it.

      FYI, you will almost certainly want to use "friendly URLs" in MODX, which requires the MODX .htaccess file, which you get by renaming the ht.access file in the MODX root (which is ignored) to .htaccess. You can add the code from your current .htaccess file to the MODX one.

      I would ignore the .htaccess issue until you get the Manager working correctly.

      Welcome to MODX. smiley
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • discuss.answer
        • 54066
        • 3 Posts
        Quote from: BobRay at Feb 18, 2018, 07:54 AM
        That line is expecting a date/timezone in the form "Europe/Paris".

        It tries to get the date_timezone System Setting in the modx_system_settings table in the DB. If it's empty, it used PHP's date_default_timezone_get(), which is unreliable.

        Probably the best solution would be to go into the database, find the date_timezone System Setting in the modx_system_settings table, and set it to one of the values here: http://php.net/manual/en/timezones.php.

        Manually delete all files in the core/cache directory after fixing the DB setting before trying to log in.

        You should also look for that incorrect date/timezone setting in any php.ini files or .htaccess file at the MODX root directory or above it.

        FYI, you will almost certainly want to use "friendly URLs" in MODX, which requires the MODX .htaccess file, which you get by renaming the ht.access file in the MODX root (which is ignored) to .htaccess. You can add the code from your current .htaccess file to the MODX one.

        I would ignore the .htaccess issue until you get the Manager working correctly.

        Welcome to MODX. smiley

        BobRay,
        Thank you. Just walked out the door from work. Following a trip to the fridge for a cold one when I get home, I'll be digging in and setting to work on your solution. I'll update back here with results thanks again!
          • 54066
          • 3 Posts
          Ok all fixed!
          Did'nt do any modifying to any tables in the DB. I went nosing around in the file system and found

          /core/cache/system_settings/config.cache.php


          and on line 48 is
          date_timezone


          of which was empty. In my case it needed
          America/Los_Angeles


          Closed the file, refreshed the page and the world seems normal again.

          Thank you your assistance and have a great day!
            • 3749
            • 24,544 Posts
            I think that will be a temporary fix. Eventually, the System Settings cache will be refreshed and you'll be back in the soup.

            While you're able to access the Manager, go to System (gear icon) -> System Settings. Find the date_timezone setting, double-click on the value field and set it to America/Los_Angeles. That will update the DB.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • Same problem after upgrading php from 5.x to 7.1 on some hosting.
              Solution of Bob worked perfectly!

              ps. It always gives me a sense of security, knowing that if I look for solutions to a problem on modx ... I will find a post by Bob: D
                TilliLab | MODX Ambassador
                website
              • Thank you Bob !
                You saved my life, again.
                  made with MODx => France Douglas || Vintage Weekender
                  • 3749
                  • 24,544 Posts
                  I'm glad I could help. smiley

                  Thanks everyone for the kind words.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                  • discuss.answer
                    • 47630
                    • 56 Posts
                    thank you for posting this solution.

                    I raised this very same issue on this thread:
                    https://forums.modx.com/thread/103995/fatal-error-in-the-manager-when-upgrade-to-php-7


                    Andy Tough kind heartedly pointed me to this thread and Bob Rays solution erased my PHP 7 issue smiley