Migration to new server DB connection problem

Started by mbartmon, April 17, 2021, 10:25:06 PM

Previous topic - Next topic

mbartmon

I need to know what I am missing.

I am attempting to migrate my forum to a new server. Entire forum directory structure was copied as was the MySQL database. Apache and PHP are installed and running.

Website is found but index.php is not working.  A 500 error is returned.

repair_settings indicates that there is a problem with the database:
Quote
"Some settings are not being shown because the database connection information is incorrect.
Check your database login details, table prefix and that the database actually contains your SMF tables."

Tasks Directory:Value not found!   
Packages Directory:Value not found!   
Cache System:Value not found!   
Enable Caching:Value not found!
Memcache Servers:Value not found!

Except for the missing settings due to no database connection all of the settings are correct including all of the database ones.

I am able to connect to the database using MySQL Workbench using the same credentials as are in Settings.php and the tables are all there and populated.

Module Versions
Quote
CentOS Verions = 6-10 (old) 7-9.2009 (new)
SMF Version = 2.0.15
PHP Version = 5.6.40
MySQL Version = 5.7.33

Settings.php
Quote
<?php
/**********************************************************************************
* Settings.php                                                                    *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1                                             *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com [nofollow])             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance = 0;               # Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)
$mtitle = 'Maintenance Mode';           # Title for the Maintenance Mode message.
$mmessage = 'Okay faithful users...we\'re attempting to migrate the server...news will be posted once we\'re back!';            # Description of why the forum is in maintenance mode.

########## Forum Info ##########
$mbname = 'CH Runners';         # The name of your forum.
$language = 'english';          # The default language file set for the forum.
$boardurl = 'http://132.148.166.56/forum'; [nofollow]
$webmaster_email = '[email protected]';           # Email address to send emails from. (like [email protected].)
$cookiename = 'SMFCookie759';           # Name of the cookie to set for authentication.

########## Database Info ##########
$db_type = 'mysql';
$db_server = 'localhost';
$db_name = 'chrunners';
$db_user = 'xxxx';
$db_passwd = 'xxxxx';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir = '/var/www/html/forum';              # The absolute path to the forum's folder. (not just '.'!)
$sourcedir = '/var/www/html/forum/Sources';             # Path to the Sources directory.

########## Error-Catching ##########
# Note: You shouldn't touch these settings.
$db_last_error = 1313756815;

# Make sure the paths are correct... at least try to fix them.
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
        $boarddir = dirname(__FILE__);
if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources'))
        $sourcedir = $boarddir . '/Sources';

$cachedir = '/var/www/html/forum/cache';
$image_proxy_secret = '0a74a0437a99f490484b';
$image_proxy_maxsize = 5190;
$image_proxy_enabled = 0;
>

Sir Osis of Liver

It's sometimes necessary to reset database password after migration.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

mbartmon

Changing the DB password did not help. I even changed it twice.

Illori

are you sure the database name is correct along with the database server url/ip address?

mbartmon

Database name is correct. It is the same name that I use in Workbench.
Database ip/url ?  If you mean the $db_server entry then, yes, 'localhost' should be correct. If I specify the -h parameter as 'localhost' using mysql  in the server terminal it connects properly.

I think that not all of the tables were backed up.  I am re-running a backup of the existing server and will see what happens when I restore it to the new server.


mbartmon

I've re-done the database and can now verify that all of the tables are present and populated.

No change in forum behavior.  Something is still wrong.

mbartmon

Perhaps I should consider doing a fresh install of SMF and then bringing a DB copy over?

mbartmon

But then what do I do with Attachments , Avatars and such?

shawnb61

I would look at are privileges & the authentication plugin.

A query you can do from either a mysql prompt or in the phpmyadmin SQL window is this:
select * from mysql.user

Two things to look for, specifically, for the DB user you use in your Settings.php file:
(1) Are all the privileges checked with a "Y"
(2) Is the plugin column set to 'mysql_native_password'
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

a10

localhost not working on my host, maybe same on yours.
Test with a complete path, like
$db_server = 'mydomain.com.mysql';
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

mbartmon

Quote from: shawnb61 on April 18, 2021, 01:53:54 PM
I would look at are privileges & the authentication plugin.

A query you can do from either a mysql prompt or in the phpmyadmin SQL window is this:
select * from mysql.user

Two things to look for, specifically, for the DB user you use in your Settings.php file:
(1) Are all the privileges checked with a "Y"
(2) Is the plugin column set to 'mysql_native_password'

Privileges look good as does the plugin password.

mbartmon

Quote from: a10 on April 18, 2021, 01:57:28 PM
localhost not working on my host, maybe same on yours.
Test with a complete path, like
$db_server = 'mydomain.com.mysql';

Just tried that. No improvement!

shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

mbartmon

Quote from: shawnb61 on April 18, 2021, 02:31:20 PM
Have you tried specifying the db port?

No. I installed mySQL using default port (3306).  Is there a Settings config for port ($db_port)?

mbartmon

I decided to try a clean install of 2.0.15 since that is the version on my old server.

Came up with the following error:
The installer was unable to detect any database support in PHP. Please ask your host to ensure that PHP was compiled with the desired database, or that the proper extension is being loaded.

php.ini has a [MySQL] section but no [PHP_MYSQL] section. Is that a problem and if so how do I fix it?

mbartmon

In case you want to look at phpinfo here is a link: http://mywebpm.com/phpinfo.php [nofollow]

mbartmon

PHP was not installed with MySQL support.  I corrected that issue and the repair_settings page now looks good.

Still cannot load the forum. index.php returns a 500 error.

Illori

what does your php error log say is causing the error?

shawnb61

One - very common - issue with repair_settings is folks not pressing SAVE...  Note also that the 'restore all settings' link puts the settings where it thinks they should be (which usually fixes a lot of issues).

Also check your SMF error log - you may be getting far enough to have something logged now...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

mbartmon

I think that php is straightened out. 

Definitely saved any changes made through repair_settings.

Nothing going into the smf error_log.

No idea where to find a PHP error log.

In the meantime,  I did a separate, new install of SMF in another directory and that was successful.  Different database with the same credentials.

Sir Osis of Liver

Quote from: mbartmon on April 18, 2021, 06:34:59 PM
I did a separate, new install of SMF in another directory and that was successful.  Different database with the same credentials.

Drop tables, import production database, see if it works.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

mbartmon

Quote from: Sir Osis of Liver on April 18, 2021, 09:38:19 PM
Quote from: mbartmon on April 18, 2021, 06:34:59 PM
I did a separate, new install of SMF in another directory and that was successful.  Different database with the same credentials.

Drop tables, import production database, see if it works.



Doing that now.

mbartmon

The new install is now working with basic functionality.  All of the members, boards, topics, posts are present.

But I do have a problem with installing some mod Packages.  After clicking on the continue button the browser returns a 500 error.  After looking at the error log and the temp folder in the Packages folder it seems as though sub folders from the archive are not being populated in the temp folder. The temp folder has the correct permissions.

Sir Osis of Liver

If you've imported the production database into clean install and it's running, you shouldn't be getting 500 errors.  Permissions for dirs/files should be 755/644, if it's a permissions problem package manager would be telling you that, shouldn't get a server error.  You may have a bad mod install.  Start over with clean files.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

mbartmon

I discovered that the web root directory (public_html in my case) needs write permissions as well. That stopped the 500 errors.

shawnb61

That was probably the root cause error all slong.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: