We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25519
    • 265 Posts
    Hi all

    I’m getting the following recurring message when i try to save any changes to any documents:

    Failed to create the database connection!
    . Please run the MODx install utility

    This seems to happen whenever i try save changes for a second time, but the first save usually seems to work.
    Regarding the message i’m receiving, I uninstalled the ’Install’ utility when i set the site up (as part of the install process) and am obviously concerned about running install over everything i’ve done so far.

    Can anyone advise as to what’s happening here???
    I backed up the database.

    thanks
      • 22303 MODX Staff
      • 10,725 Posts
      That honestly sounds like a problem with your host’s database connectivity. Without any additional details, it’s pretty hard to diagnose what the issue really is. If it just started happening out of the blue, I would contact the host.
        • 25519
        • 265 Posts
        Thanks, i’ll get in touch with them - does the ’Please run the MODx install utility’ message sound at all familiar to you?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That is the error message when the Manager’s index.php file can’t connect to the database (line 136):
          // connect to the database
          if(@!$modxDBConn = mysql_connect($database_server, $database_user, $database_password)) {
              die("<h2>Failed to create the database connection!</h2>. Please run the MODx <a href='../install'>install utility</a>");
          } else {
              mysql_select_db($dbase);
              @mysql_query("SET CHARACTER SET {$database_connection_charset}");
          }
          

          I suppose the presumption was that the config.inc.php file was missing or in error.
            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
            • 25519
            • 265 Posts
            Thanks for the replies
            The problem seems to have stopped. i got in touch with the client’s server bods (1and1) and they said no work was being done server-side, so i guess i’ll just have to roll with that.
            It’s good to know the php source of the error comment - however, the config.inc file was present and correctly configured.

            My instinct tells me it was some server maintenance but i guess i’ll never know!

            thanks
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It could just be an overloaded server, and your attempt to connect fails because the database server is just too busy.
                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
                • 25519
                • 265 Posts
                that sounds quote possible
                  • 25519
                  • 265 Posts
                  Woah - it’s happening again today!

                  If i did follow the error message - "Please run the MODx install utility" - what would happen???
                  I tried this on a local xampp test site and it completely broke the site so i’m obviously a bit wary of doing it on a live server.

                  thanks
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    It’s not necessary; that message was added because it was thought that there was a problem with the installation causing the database failure. It still sounds like a fairly typical overloaded shared server problem. The actual error is being masked; you could try temporarily removing the @ at the beginning of the connection attempt in the index.php file to allow the actual error to be displayed.
                      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
                      • 25519
                      • 265 Posts
                      thanks - all behaving well right now but i’ll apply this if needs be