We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    On a 2.2.10 Revo install (I know, we need to update, it's already scheduled) suddenly the following happens: when I try to create and save a new user, I can't save the user. Chrome developer console says:

    POST https://www.mywebsite.nl/connectors/security/user.php 500 (Internal Server Error) 
    i - ext-base.js:21
    Ext.lib.Ajax.k.request - ext-base.js:21
    Ext.extend.request - ext-all.js:21
    Ext.extend.run - ext-all.js:21
    (anonymous function) - ext-base.js:21


    user.php does exist and looks normal.

    The Apache error log has the following error:

    PHP Notice:  Undefined index: HTTP_HOST in /home/mywebsite/domains/mywebsite.nl/public_html/core/config/config.inc.php on line 65


    Does anyone have a clue what could be causing this?
    • Did you make any recent changes to the hosting environment?
        Patrick | Server Wrangler
        About Me: Website | TweetsMODX Hosting
        • 3749
        • 24,544 Posts
        Is there anything odd near that line in config.inc.php?

        It's possible that you've been hacked.
          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
          • 19328
          • 433 Posts
          Thanks for your responses! I don't think anything changed in the hosting environment, but I'm going to check again. In config.inc.php there is nothing odd, I compared the file and found nothing unusual...

          The Chrome console also gives the following error (slightly different than the one I already posted):

          Failed to load resource: the server responded with a status of 500 (Internal Server Error):
          https://www.mysite.nl/connectors/security/user.php


          However I can open that file in the browser and get a response.
          • This is what you should have for line 65
            $http_host= str_replace(':' . $_SERVER['SERVER_PORT'], '', $http_host); // remove port from HTTP_HOST
            

            This is from a fresh installation of 2.2.10
              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
              • 3749
              • 24,544 Posts
              I think I see what the problem is. You have E_NOTICE errors and possibly display_errors() turned on (they should be off on a production server) and it looks like your server is not setting the HTTP_HOST server variable.

              That makes PHP produce the warning message when it sees $SERVER['HTTP_HOST'], which leads to the 500 error, since that member of the array is undefined.
                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
                • 19328
                • 433 Posts
                Thanks Sottwell and BobRay! Sottwell, I checked the line and it is exactly as the one you posted. So I'm hopeful the site has not been hacked (shouldn't there be other problems as well if it has been hacked?)

                BobRay, I'm impressed by your analysis. Thanks for your help! This week we're updating the site to the newest Revo version and we'll check all these settings as well. I hope this will resolve the issue!
                  • 3749
                  • 24,544 Posts
                  I wouldn't be surprised if the newer version is more fault-tolerant. wink
                    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
                  • Oddly, yesterday I ran into a very similar situation on a localhost installation. I had just installed a brand-new copy of Revo 2.3, built from the github repository. After an hour or so of working on a new Site Template package, I was suddenly getting white screens when trying to edit resources. Nothing in the MODX logs, but an examination of the MAMP php error log showed a critical class wasn't found. huh

                    So I went into another installation and copy/pasted the core directories (not components or config), and all is well again. What happened? I dunno. I've done another installation in the same way; we'll see if it falls down any time soon.

                    Oh, and I forgot to mention that at the same time the System Settings had stopped saving. Also a critical class wasn't found. [ed. note: sottwell last edited this post 9 years, 10 months ago.]
                      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
                      • 19328
                      • 433 Posts
                      Well, we updated to 2.2.14 and the problem persists. So I think it has to do with the server configuration. However, we still can't find the problem. We checked if E_NOTICE errors and display_errors were turned off (they are) and also if the http_host variable is set, it is.

                      Things we also tried: disabling the .htaccess file, checking the rights of the folder+file that is giving problems (folders 755, file 644), increasing the php memory, overwriting the core files like Susan suggested. Nothing helps.

                      When we turn display_errors on in the .htaccess file (in hopes of finding the problem) we did find that instead of the POST error (/connectors/security/user.php 500 (Internal Server Error) ) there is a different error in the Firebug panel (and no 500 error):

                      TypeError: o.result is undefined
                      https://www.mywebsite.nl/manager/assets/modext/widgets/security/modx.panel.user.js
                      Line 95


                      However the POST data in the Firebug console does have the POST info but no answer, so I think it's the same problem.

                      We're out of ideas for now... Next step is getting help from the host. I'll let you know what happens.