• Welcome to Simple Machines Community Forum. Please login or sign up.
October 25, 2021, 02:08:14 PM

News:

Wondering if this will always be free?  See why free is better.


Unable to connect to database after applying 2.0.14 patch

Started by Turrican3, May 17, 2017, 06:59:46 AM

Previous topic - Next topic

Turrican3

Hi guys, I'm having issues with the 2.0.14 patch.

Installation reports no issues at all, but at first I got an error message regarding Load.php module at line 142.

I had a look at this section and discovered that, despite the README patch claiming the opposite, PHP 5.3 is *not* tha actual minimum required version (or at least has issues)

So, I set up my host to run on PHP 5.6.x branch and the Load.php error disappeared... but now I am stuck with the "cannot connect to database" error.

I checked Settings.php and everything seems fine BUT... repair_settings.php claims there are, infact, issues while connecting to the database despite showing correct values in the dedicated fields.

Right now I reverted to a 2.0.13 backup but I'd clearly like to stay up-to-date (also because due to a weird concidence I've just noticed my hosting just enabled https so I'd like to use it as well, and I understand that 2.0.14 also serves this purpose)

Any suggestions?

vbgamer45

The 2.0.14 patch moved the min to 5.4    I would stay 5.6 as well.
Do you have mysqi installed when upgrading php to 5.6 and check that mysql extensions are installed as well.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Turrican3

Thanks for the reply!

Unfortunately I have no terminal access to the server (it's a cheap, yet decent host so no complaints here), but I think a dump of phpinfo html would be enough to check everything needed is here, right?

vbgamer45

Yeah just check phpinfo and see if mysql or mysqli are installed
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Turrican3

I see both mysql and mysqli sections, but I don't know about the specific values/parameters listed.

Anything special that might need to be verified there or do we have to look/check elsewhere?

vbgamer45

That should do it... I saw one post mention the user had 127.0.0.1 as the host try changing it to localhost:3306
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Turrican3

I'll give it a try but I'm 99% confident that won't work, as I said this is a cheap, shared hosting so we (they) have mysql on a separate server :-\

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Turrican3

Anything else worth checking like, I don't know, a log or something like that?

Would a little test like this supply further information so we can track the issue down?

SleePy

Turrican3,

Open Settings.php and add at the end before the ?>

$db_show_debug = true;


Save it and refresh your site.  It should give you a more detailed error message as to why its not connecting.
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:GitHub
Join us on IRC Libera.chat/#smf

Turrican3

Great, didn't know about that option!

I'll give it a try, thanks.

SleePy

Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:GitHub
Join us on IRC Libera.chat/#smf

Turrican3

Sorry, it's been a very busy week at work and this prevented me from re-trying to apply the forum update/patch. :-\

Turrican3

Ok, tried adding the debug stuff but apparently nothing changed, I still get the same generic "unable to connect to the database" message.

Turrican3

I *think* I know where the issue lies, but I have no clue where exactly...

Tried to have a look at the PHP code (definitely not an expert), and to me it seems there are issues with the functions that connect to the database in Subs-db-mysql.php

As a matter of fact, as soon as I replaced the 2.0.14 version with the previous one, the forum immediately came online as usual!

Maybe it depends on the new MySQLi stuff?

PS: by the way, I don't really think this is a stable configuration... heck, I see that file basically doubled in size compared to the previous version, surely there's something in that added code that sooner or later will make the forum not working as intended or, even worse, damaging stuff on the database?!

PPS: with the "old" Subs-db-mysql.php I also do NOT get any error messages when using repair_settings.php

Turrican3

Additional info that *might* prove useful.

Tried to upload a very small PHP test file:

<?php
$mysqli 
= new mysqli("MYSERVER""MYUSERNAME""MYPASSWORD");

/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* print server version */
printf("Server version: %s\n"$mysqli->server_info);

/* close connection */
$mysqli->close();
?>


That gives this error message:

QuoteWarning: mysqli::mysqli(): (HY000/2000): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in /web/htdocs/www.gamers4um.it/home/public/smf/prova.php on line 2
Connect failed: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

I understand 2.0.14 uses mysqli so maybe this is the exact same reason why the upgraded SMF says it cannot connect to the database?!

Kindred

ummm... are you still on php 5.2 and mySQL4?

If so...   yeah, that would be an issue.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Turrican3

Nope, I'm using MySQL 5.0.x and PHP 5.6.x right now.

Anyway, I solved the issue by running the SET PASSWORD command on the database (via phpmyadmin) as per previous quote, and now it's working!

I have a different issue right now but I guess I'll use another thread. Marking this as solved.

SleePy

Well that is an issue that is difficult to test for as it has to do with outdated mysql passwords that need updated to the newer 4.1+ format.  Although setting that debug statement in your Settings.php should have revealed you that same error message.  Thanks for the update.
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:GitHub
Join us on IRC Libera.chat/#smf

Turrican3

Just out of curiosity... isn't that actually an issue with mysqli (i.e. the new driver) or whatever?

I mean, I've been running on 5.0.x for a good while, but it was just this forum 2.0.14 update that triggered (well, basically forced should I say) that password/hash change.

Advertisement: