Jump to content
TNG Community

Error: TNG is not communicating with your database.


WantItRight

Recommended Posts

I woke up this morning to an e-mail alert from someone trying to reach one of many (about 15) TNG sites that it was not accessible. In checking all of my different sites, I find that they are all getting the error message " Error: TNG is not communicating with your database. Please check your database settings and try again."

In Googling this problem, I found the TNG Wiki page https://tng.lythgoes.net/wiki/index.php?title=TNG_not_communicating_with_database

The recommendations on the page all assume that I can access my administrator tools. But the reality is that the error message comes up, and I have no access to my database at all: nothing comes up except a blank screen with this error message. So the recommendations on the TNG Wiki are of no use to me to resolve whatever has gone wrong on all my sites at once.

The other thing that comes up when Googling is that all other reports of this problem are 2.5 years old or more. So there is no recent experience to go on which might explain what has caused this universal failure of all my sites.

Help!!

Here are URLs for some of my sites

http://www.wwjohnston.net/famhist/celtic-roots-tree/

http://www.wwjohnston.net/famhist/subert-nevole/tree/index.php

http://www.wwjohnston.net/famhist/terug-in-de-tijd/index.php

I am not sure what version of TNG these are, since I set them up long ago and simply replace the databases with snapshots from my Ancestry master versions from time to time. I think it is either TNG 9 or 10.

Link to comment
Share on other sites

The database connection parameters can always be changed in your config.php, but with that many database connections not working, you probably should check with your hosting service if they changed something or move your database server so you no longer have access

Link to comment
Share on other sites

2 minutes ago, Ken Roy said:

The database connection parameters can always be changed in your config.php, but with that many database connections not working, you probably should check with your hosting service if they changed something or move your database server so you no longer have access

Thanks for the prompt reply. You are going to have to spell things out for me, since this is an area where I am a total novice.

Looking at the config.php on one of my sites, there are a slew of parameter settings. The database settings seem to be first. Here is what they show:

$database_host = "localhost";
$database_name = "wwjohnst_celtic";

I have no idea what to do with that information to check anything, but this does not look like it has changed.

My server space is on BlueHost. I can certainly call them, but I am not really sure what to say to them other than that I am suddenly getting this error on all my sites. Is there something more specific that I should tell them?

Link to comment
Share on other sites

You will need to contact your host.  I know nothing about BlueHost.  You need to ask them to verify what the connection parameters should be and let them know that TNG is returning an error message that it cannot communicate with the database.

Link to comment
Share on other sites

BlueHost technical support could not figure out which of the many TNG files to look at in order to try to figure out what they might have done at BlueHost that could have impacted all of my databases.

So they had me restore the files to a backup done 9 days prior to when I was alerted to the problem. The restore took more than 12 hours to run. But when it completed, the same problem remianied. Anyone going to the URL for any of my TNG sites receives a blank screen with the message "Error: TNG is not communicating with your database. Please check your database settings and try again."

Is there any particular TNG file that I should tell BlueHost tech support to look at so that they can try to figure out what has caused the problem?

Link to comment
Share on other sites

In desperation, with no new information other than that the restore did not resolve the problem, I again called BlueHost support. I asked if there had been any migration recently of my files. It turned out that on September 19, they migrated my files to a new server.

The new server is configured to support PHP versions 5.6 or above, and the BlueHost tech support person said that my files are running PHP version 5.2. So this is apparently the problem.

I installed these file in 2015, and the only updates have been to the database content -- which was a total replace every time I rolled a new snapshot of the master database on Ancestry into the public TNG version. So, I have made no updates to the PHP files or any other aspects of the TNG software.

So what do you experts recommend that I do to resolve the problem? Should I download the latest TNG software and set up my databases all over agai? Or is there a way to download the latest software and only move the PHP files over to my folders on the server?

As I said, I am a total novice at this. I used the TNG GUIs to do the installation and really do not know much about what is under the hood.

Link to comment
Share on other sites

If you look at the version.php file using a FTP client or their FileManager app, it should tell you what TNG version you are running.  You do need to know what TNG version you are running in order to use the correct upgrade.

Link to comment
Share on other sites

That should be a question for your host site as to why you are on PHP 5.2?  TNG version 10.1.1 should run on PHP 5.6 but will not run on PHP 7.2 or later.  See TNG versions

Link to comment
Share on other sites

Maybe the question to Blue Host is whether they are running your server on PHP 7.2 or 7.3.  If yes, then how can you select PHP 5.6

Link to comment
Share on other sites

I'm still on the phone with BlueHost, and we converted to PHP 5.6, but that did not solve the problem.

We found the error msg is generated in tngconnect.php by this code:

function tng_db_connect($dbhost,$dbname,$dbusername,$dbpassword) {
    global $textpart, $session_charset, $tng_notinstalled;

    $link = tng_connect($dbhost, $dbusername, $dbpassword);
    if ($session_charset == 'UTF-8')
        tng_set_charset($link, 'utf8');
    if( $link && tng_select_db($link, $dbname))
        return $link;
    else if( $textpart != "setup" && $textpart != "index" ) {
        if(isset($tng_notinstalled) && $tng_notinstalled){
            header("Location:readme.html");
            exit;
        }
        else
            echo "Error: TNG is not communicating with your database. Please check your database settings and try again.";
        exit;
    }
    return( FALSE );
}

which uses this function

function tng_connect($dbhost, $dbusername, $dbpassword) {
    global $link;
    return @mysqli_connect($dbhost, $dbusername, $dbpassword);

 

But so far we cannot see how this is failing.

 

 

 

 

Link to comment
Share on other sites

OK, he has one of my databases back up. He said that the dbuser had gotten out of sync somehow (maybe thru a migration). So one by one for each database, he has to save the password, delete the user, re-create the user with the same name, relink it with the password to the database. At least at this point, I think that is what the process is.

I misunderestimated how many sites I have when I said about 15 ... there are 21 different databases.

Link to comment
Share on other sites

Just now, WantItRight said:

OK, he has one of my databases back up. He said that the dbuser had gotten out of sync somehow (maybe thru a migration). So one by one for each database, he has to save the password, delete the user, re-create the user with the same name, relink it with the password to the database. At least at this point, I think that is what the process is.

I misunderestimated how many sites I have when I said about 15 ... there are 21 different databases.

It sounds like they messed something up when they migrated you to a different server. Perhaps not deliberately, but the "out of sync" you mention is presumably because of something they did.

Roger

Link to comment
Share on other sites

It took a long time to do all the changes via the cPanel. Here are the steps I had to do for each database.

1. View the config.php file for each tree/database, and copy the dbuser and dbpassword to a Notepad window.

2, Delete the dbuser.

3. Re-create the dbuser with the exact same name and password.

4. Add the user to the database, giving all privileges.

It looks real simple, and it was really just a clerical task -- repeated 21 times.

They gave me a month's credit for having put me through this grief.

Link to comment
Share on other sites

  • 1 year later...

Thanks Ken Roy, for the advice given here. When accessing my site this morning I was confronted with the same problem as described here and after panicking and fearing for the worst, I was able to restore access. For some reason the site hosts activated PHP 7.4, but I was able to correct this in cPanel (PHP Selector).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...