We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49875
    • 7 Posts
    Hi guys,
    I am getting this error in the manager. I am not able to use the manager properly because of it as it is blocking in some way javascript and consequently the loading of some of the elements. Any idea ?

    Error:
    t May 23 14:07:44 2015] [error] [client 2.28.147.53] [host www.hidden.com] Backend fatal error: PHP Fatal error: Undefined class constant 'LOG_LEVEL_ERROR' in /home/hidden/public_html/core/model/modx/error/moderrorhandler.class.php on line 111\n.

    Any help is much appreciate.

    Thanks.

    Margherita
      • 3749
      • 24,544 Posts
      What version of MODX are you running?

      The error level constants were changed at some point, and should all be written in this form:

      modX::LOG_LEVEL_ERROR


      Take a look at the line in the moderrorhandler class file mentioned in the error message and see if it begins like this:

      $this->modx->log(modX::LOG_LEVEL_ERROR
        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
        • 49875
        • 7 Posts
        Quote from: BobRay at May 24, 2015, 12:00 AM
        What version of MODX are you running?

        The error level constants were changed at some point, and should all be written in this form:

        modX::LOG_LEVEL_ERROR


        Take a look at the line in the moderrorhandler class file mentioned in the error message and see if it begins like this:

        $this->modx->log(modX::LOG_LEVEL_ERROR

        Hi Bob,
        Thank you for your reply.

        I am running MODX 2.3.3 and I checked the line in question and yes, it is like you say:
        $this->modx->log(modX::LOG_LEVEL_ERROR, $errmsg, '', '', $errfile, $errline);

        Every time I click on an element (resource, TV, chunk etc.etc.) it comes up a pop up with a 500 internal error message and in the log I got like 10+ line of this errors: Backend fatal error: PHP Fatal error: Undefined class constant 'LOG_LEVEL_ERROR' in /home/thelangu/public_html/core/model/modx/error/moderrorhandler.class.php on line 111\n.

        I tried to changed the permissions, but nothing changed. I tried to re-install MODX, but nothing changed. I have already had problems with mod_security, basically I couldn't install any plugin, but that has been solved.

        Any idea ? Anything that I might ask to the web hosting guys to check ?

        Thanks!!

        Margherita
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          That error is typically caused by a request to MODX being closed with a exit() or die() statement, without closing the sessions first with @session_write_close();

          For example something like this in a snippet will trigger the error when the page is called with an "ajax" parameter:

          <?php
          $result = $modx->getChunk('foo');
          if (isset($_GET['ajax'])) {
            exit($result);
          }
          return $result;


          but with the addition of this one line, it will work fine without the error:
          <?php
          $result = $modx->getChunk('foo');
          if (isset($_GET['ajax'])) {
            @session_write_close();
            exit($result);
          }
          return $result;


          That you're seeing the error in a pop up indicates the error is coming from an AJAX request via ExtJS - since 2.3 that will show most ajax errors in a pop up.

          Tracking down which request is it, that's the fun part... you can see all the requests happening by looking at the browser's developer tools, in the Net or Network tab typically. One of them will have the error in its response text. Once you found out which one it is, you can look at the filename it is requesting and the form data or url parameters in the request to see what php file is actually responsible so you can fix it.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 3749
            • 24,544 Posts
            Another quick test would be to disable all plugins (right-click on them in the tree) and clear the site cache (preferably by deleting all files in the core/cache directory or running the CacheClear extra). If that makes it go away, you can re-enable the plugins one by one to see which one has the problem Mark is describing.
              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
              • 49875
              • 7 Posts
              Hi Bob and Mark,

              Thank you very much for your replies.

              I think the problem was a mis-configuration on the server. I was in shared, but because the web hosting guys couldn't solve the issue, moved me to a VPS which basically solved everything. Now I can use the manager without errors. I do not know was caused it though.

              I can only add the I haven't written any snippet myself as I didn't have the time really as the error come since the installation and I tried to disable all the plugins too, but that wasn't the problem.

              Anyway, now it works and I can go back to MODX! smiley

              Thanks.

              P.s.
              Bob I bought you book and I see your website every time I need help. Thank you for your effort in making MODX easier.

              Margherita
                • 49875
                • 7 Posts
                Hi guys,

                unfortunately I talked too soon. It worked for a few minutes, now it doesn't. Same errors in the log.
                It is strange because it works for a while without errors in the console or log, than suddenly come up the 500 internal error pop-up and it starts to triggers errors in the console and it doesn't load all the elements. When it happens, I click on the dashboard button(logo) and everything go back to normal, it works fine again with no errors.
                There is no a specific pattern, sometimes happen when I click on a single resource, sometimes a single TV, sometimes a chunk. I don't know...
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Try turning off compress_js and compress_css.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 49875
                    • 7 Posts
                    Quote from: sottwell at May 25, 2015, 04:02 AM
                    Try turning off compress_js and compress_css.

                    Hi Sottwell,
                    Thank you for your reply.
                    I tried that, nothing.

                    These are some errors I keep getting in the console:

                    /connectors/index.php?action=element/getnodes&id=root 500 (Internal Server Error)
                    /connectors/index.php 500 (Internal Server Error)
                    /connectors/index.php 500 (Internal Server Error)

                    See the screenshot I made. None elements loaded and some errors in the console.
                      • 3749
                      • 24,544 Posts
                      Quote from: lucamjj at May 25, 2015, 02:04 AM

                      P.s.
                      Bob I bought you book and I see your website every time I need help. Thank you for your effort in making MODX easier.
                      Margherita

                      Thanks for the kind words.

                      It sounds like the cache may be getting corrupted.

                      I think disabling all plugins is still a good next step.
                        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