XF 2.2 Database error after moving to new server

twollert

Active member
I tested moving my database and files to a new server. The config.php contains the new database details. data and internal_data is set to CHMOD 777.

But when I try to enter the site I get the following error:

An unexpected database error occurred. Please try again later.
<!-- php_network_getaddresses: getaddrinfo failed: Name or service not known -->

XF 2.2.12
PHP 8.0.27

What can I do to fix it?
 
Solution
I tested moving my database and files to a new server. The config.php contains the new database details. data and internal_data is set to CHMOD 777.

But when I try to enter the site I get the following error:



XF 2.2.12
PHP 8.0.27

What can I do to fix it?
I would specifically check the hostname of the DB server in the config file. Be sure that the hostname is correct as well as credentials while you're at it. But the basic error points to not being able to connect to the DB...
I tested moving my database and files to a new server. The config.php contains the new database details. data and internal_data is set to CHMOD 777.

But when I try to enter the site I get the following error:



XF 2.2.12
PHP 8.0.27

What can I do to fix it?
I would specifically check the hostname of the DB server in the config file. Be sure that the hostname is correct as well as credentials while you're at it. But the basic error points to not being able to connect to the DB...
 
Solution
Thanks, I changed that. (y)

But now I get forwarded to my live site, when I enter the URL of my test site (on the new server). How can I avoid that?
You are supposed to use the new server’s db credentials. Did you actually import the database to the new server? Or just copied the site files?

But yeah, you will get your live site if you use the credentials of your live site.
 
But I get forwarded to the live site anyway when I try to access XenForo on the new server... 🤷‍♂️
Are you using a special domain or sub-domain to access the new site location?
You'd have to have setup a temporary domain or sub-domain that doesn't direct traffic to your live site.
 
Change the Board URL by logging in to the ACP directly.

Or edit the config.php file and add:

PHP:
$c->extend('options', function(\ArrayObject $options)
{
    $options->boardUrl = 'https://localhost/xf';
    $options->boardUrlCanonical = false;
    return $options;
});

Change the URL as required.
 
  • Like
Reactions: ENF
Back
Top Bottom