Jump to content

Migrated to New Server - conf_global Correct, but Can't Connect to DB/500 Errors


Recommended Posts

I migrated my site to a new server.  This includes a Drupal site and the Invision boards.  They're on the same server, in the same domain, and leveraging the same DB.  While Drupal is running fine, Invision won't load any pages I've tried, giving me a 500 and displaying "no such file or directory".

Looking in the logs I found this...

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught IPS\\Db\\Exception: No such file or directory in /var/www/vhosts/cruisehabit.com/httpdocs/boards/system/Db/Db.php:269\nStack trace:\n#0 /var/www/vhosts/cruisehabit.com/httpdocs/boards/system/Db/Db.php(356): IPS\\_Db->_establishConnection()\n#1 /var/www/vhosts/cruisehabit.com/httpdocs/boards/system/Db/Db.php(487): IPS\\_Db->checkConnection()\n#2 /var/www/vhosts/cruisehabit.com/httpdocs/boards/system/Db/Db.php(972): IPS\\_Db->preparedQuery()\n#3 /var/www/vhosts/cruisehabit.com/httpdocs/boards/system/Session/Admin.php(112): IPS\\_Db->replace()\n#4 [internal function]: IPS\\Session\\_Admin->write()\n#5 [internal function]: session_write_close()\n#6 {main}\n thrown in /var/www/vhosts/cruisehabit.com/httpdocs/boards/system/Db/Db.php on line 269'

Each line referenced is just related to attempting to connect/get data from the DB, sooo, it's a long way of saying it can't connect to the database (which would seem something to pass to the error page).

The strange thing is, the database name, user, pass, host, and port are identical to what I have configured for Drupal, so I'm confident that is all correct.  I've checked and recopied the info a dozen times.  The only other variable is the socket - but it's pretty standard (/var/lib/mysql/mysql.sock) and I confirmed this is the right path for this server.

I tried looking in the MariaDB logs but am new to Plesk and the logs I'm seeing there have nothing recent.  I've not found where else to look yet.

Is there something else I should be checking in a scenario where another application on the same box can connect with a set of creds but Invision can't?  I'm really out of ideas.

Edited by CruiseHabit
Link to comment
Share on other sites

When you say they're leveraging the same DB, do you mean both applications are in the same database, or they are on the same database server? The former would be very bad without proper prefixes and even still, not recommended.

Outside of the above, would ensure that the database host you're connecting to in the conf_global.php is correct. The database was restored correctly on your new server. 

Link to comment
Share on other sites

3 hours ago, Jim M said:

When you say they're leveraging the same DB, do you mean both applications are in the same database, or they are on the same database server? The former would be very bad without proper prefixes and even still, not recommended.

Outside of the above, would ensure that the database host you're connecting to in the conf_global.php is correct. The database was restored correctly on your new server. 

They're using the same DB - each with unique prefixes.  The same as it had been operating on the old server.

The database seems fine.  Not only does integrity seem fine as the Drupal site is working without issue, but I've verified the Invision tables are in place, and I've even re-exported and re-imported the old/working DB again to ensure nothing weird happened there.  

The details in conf_global have been verified (and re-entered) multiple times.

Link to comment
Share on other sites

Assuming that all the db and the other info have been entered correctly to the conf_global.php file, it looks like that for some reason your forum is not able to connect to MySQL.

What value have you entered for the sql_host at the conf_global.php file?

Are you on a shared host or do you have your own vps/dedicated box?

Link to comment
Share on other sites

@Miss_B This is on a VPS with a single dedicated IP.  All the checks come back fine except for DB connection, and mysqli is enabled.  

conf_global.php > sql_host is set to localhost (just as is was on the previous server) as the DB server is on the same VPS as the web server that has Invision on it.  I've pased the file below (not that any of this part isn't clear/easy), but aside from where I masked the password, this is the exact file.  All I changed from the previous server is the database name, username and password (which again, all work fine for Drupal).  As the DB was literally and import/export, the prefix remains the same, and the socket location is correct on both servers.

<?php

$INFO = array (
  'sql_host' => 'localhost',
  'sql_database' => 'cruisehabit_7',
  'sql_user' => 'cruisehabit_7',
  'sql_pass' => '*******',
  'sql_port' => 3306,
  'sql_socket' => '/var/lib/mysql/mysql.sock',
  'sql_tbl_prefix' => 'InvisionCommunity_',
  'sql_utf8mb4' => true,
  'board_start' => 1575829565,
  'installed' => true,
  'base_url' => 'https://www.cruisehabit.com/boards/',
  'guest_group' => 2,
  'member_group' => 3,
  'admin_group' => 4,
);


 

Link to comment
Share on other sites

Marc Stridgen
This post was recognized by Marc Stridgen!

Miss_B was awarded the badge 'Helpful' and 5 points.

9 hours ago, CruiseHabit said:

@Miss_B This is on a VPS with a single dedicated IP.  All the checks come back fine except for DB connection, and mysqli is enabled.  

conf_global.php > sql_host is set to localhost (just as is was on the previous server) as the DB server is on the same VPS as the web server that has Invision on it.  I've pased the file below (not that any of this part isn't clear/easy), but aside from where I masked the password, this is the exact file.  All I changed from the previous server is the database name, username and password (which again, all work fine for Drupal).  As the DB was literally and import/export, the prefix remains the same, and the socket location is correct on both servers.

<?php

$INFO = array (
  'sql_host' => 'localhost',
  'sql_database' => 'cruisehabit_7',
  'sql_user' => 'cruisehabit_7',
  'sql_pass' => '*******',
  'sql_port' => 3306,
  'sql_socket' => '/var/lib/mysql/mysql.sock',
  'sql_tbl_prefix' => 'InvisionCommunity_',
  'sql_utf8mb4' => true,
  'board_start' => 1575829565,
  'installed' => true,
  'base_url' => 'https://www.cruisehabit.com/boards/',
  'guest_group' => 2,
  'member_group' => 3,
  'admin_group' => 4,
);


 

Additionally I would also check that  the mysql.default_socket has the correct/right value for the path to the mysql.sock file.

In the meantime there are a couple of things that you can try and see if they will help.

Can you leave the sql_socket value empty? If that won't help can you enter 127.0.0.1 as value for sql_host instead of the localhost and see if that would help.

As per the php manual, when you connect to localhost the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used instead. You could try using "127.0.0.1" if the socket connector is not enabled/working, which appears to be the case here.

https://www.php.net/manual/en/mysqli.quickstart.connections.php

 

 

 

Edited by Miss_B
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...