ElkArte Community

Project Support => Support => Topic started by: badmonkey on October 26, 2021, 04:34:24 am

Title: migration issue
Post by: badmonkey on October 26, 2021, 04:34:24 am
Hey gang! Hope everyone is well. I'm experiencing a strange issue during a server migration. Let's begin with the specs:

elk 1.1.8
Centos 8 stream
nginx 1.21.3
mariadb 10.6
php 7.4

What works:

three other elk installations migrated flawlessly and continue operating perfectly. The migrated domain serves static files and simple php files fine. For example, a test.php containing the phpinfo() function displays the information one would expect. Also, phpmyadmin is operational through the domain.

What doesn't:

The domain in question returns a 500 error accessing index.php. No errors show in the server logs. Attempting repair_settings.php use returns a 503 error and this in the server error log:


[font=Consolas, "Courier New", monospace]thrown in /home/name/sources/database/Db-mysql.class.php on line 77" while reading response header from upstream, client: 172.220.170.39, server: name.com, request: "GET /repair_settings.php HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "www.name.com"
2021/10/26 02:07:42 [error] 330265#330265: *16 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Function get_magic_quotes_gpc() is deprecated in /home/name/repair_settings.php on line 68PHP message: PHP Fatal error:  Uncaught Error: Class 'Errors' not found in /home/name/sources/database/Db-mysql.class.php:77
Stack trace:


[/color]
#0 /home/name/sources/database/Database.subs.php(33): Database_MySQL::initiate()
#1 /home/name/repair_settings.php(120): elk_db_initiate()
#2 /home/name/repair_settings.php(21): initialize_inputs()
#3 {main}
  thrown in /home/name/sources/database/Db-mysql.class.php on line 77" while reading response header from upstream, client: xxxxxx, server: name.com, request: "GET /repair_settings.php HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "www.name.com"



[/font][/size][/color]It's as though elk is not connecting to the database? I"ve verified the information in settings.php time and again. I reset the database user and password in phpmyadmin. I even dropped the database and user, recreated, and still no dice. Am I way off base? I'm stumped! Anyone have ideas? Thanks!


Title: Re: migration issue
Post by: Spuds on October 26, 2021, 04:41:57 pm
That would indicate its not connecting to the database (setting aside the rest of the errors).

You can try a simple script to connect and maybe capture the error.
Code: [Select]
<?php
error_reporting(E_ALL);

$db_server = "localhost";
$db_user = "username";
$db_passwd = "password";
$db_name = "elkarte";
$db_port = 0;

$connection = mysqli_connect($db_server, $db_user, $db_passwd, $db_name, $db_port);

if (!$connection)
{
echo mysqli_connect_error();
die;
}

echo "success";
Title: Re: migration issue
Post by: badmonkey on October 27, 2021, 01:44:25 am
Quote from: Spuds – That would indicate its not connecting to the database (setting aside the rest of the errors).

You can try a simple script to connect and maybe capture the error.
Code: [Select]
<?php
error_reporting(E_ALL);

$db_server = "localhost";
$db_user = "username";
$db_passwd = "password";
$db_name = "elkarte";
$db_port = 0;

$connection = mysqli_connect($db_server, $db_user, $db_passwd, $db_name, $db_port);

if (!$connection)
{
echo mysqli_connect_error();
die;
}

echo "success";

Thanks spuds! It's good and bad news. The good news is the script works, and the file successfully connects to the database. So that's working. The bad news is I still don't know the problem. I reuploaded freshly transferred sources and themes directories along with top level files from the formerly working installation. File ownership and permissions have all be set (again). What else is there?
Title: Re: migration issue
Post by: Spuds on October 27, 2021, 03:30:42 am
Humm ... what happens when you try to bring up yoursite/ssi_examples.php ?
Title: Re: migration issue
Post by: badmonkey on October 27, 2021, 03:31:21 am
OK, I got this sorted. Here's the lowdown, lest it helps anyone else. The sites migrating easily/successfully had Simple Portal in Integration Mode. Transferring files then importing the database worked without issue. The problematic domain had SP disabled.

Solution? On the old server SP reenabled, export the database, import the db on the new server, point the DNS, run repair_settings.php, and voila!! No problem. Disable SP again and everything is up and running. 

Thanks for your help @Spuds‍ 
Title: Re: migration issue
Post by: Spuds on October 27, 2021, 03:32:30 am
Thanks for posting the fix, glad things are back up :D
Title: Re: migration issue
Post by: badmonkey on October 27, 2021, 03:37:16 am
Quote from: Spuds – Thanks for posting the fix, glad things are back up :D


Thanks man. Admittedly it was a bit maddening. Hours of WTH is wrong!?!?!? followed by questioning sanity. OK, the last part is untrue. There's nothing left to question.  :D  :D  But it's fixed.  8)