Advertisement:

Author Topic: Unable to connect to database after applying 2.0.14 patch  (Read 1909 times)

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Unable to connect to database after applying 2.0.14 patch
« on: May 17, 2017, 06:59:46 AM »
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?

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,298
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #1 on: May 17, 2017, 07:08:08 AM »
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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #2 on: May 17, 2017, 07:19:57 AM »
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?

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,298
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #3 on: May 17, 2017, 07:22:07 AM »
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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #4 on: May 17, 2017, 07:26:42 AM »
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?

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,298
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #5 on: May 17, 2017, 07:27:42 AM »
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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #6 on: May 17, 2017, 07:36:35 AM »
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 :-\

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,298
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #7 on: May 17, 2017, 07:42:56 AM »
Yeah that won't work if separate serer then
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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #8 on: May 17, 2017, 08:02:12 AM »
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?

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 30,309
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #9 on: May 18, 2017, 06:38:10 PM »
Turrican3,

Open Settings.php and add at the end before the ?>
Code: [Select]
$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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #10 on: May 19, 2017, 04:35:39 AM »
Great, didn't know about that option!

I'll give it a try, thanks.

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 30,309
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #11 on: May 24, 2017, 07:11:54 PM »
Turrican3,

Any update here?
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:
GitHub

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #12 on: May 25, 2017, 03:31:31 AM »
Sorry, it's been a very busy week at work and this prevented me from re-trying to apply the forum update/patch. :-\

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #13 on: May 25, 2017, 04:15:49 AM »
Ok, tried adding the debug stuff but apparently nothing changed, I still get the same generic "unable to connect to the database" message.

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #14 on: May 25, 2017, 05:08:10 AM »
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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #15 on: May 25, 2017, 06:09:08 AM »
Additional info that *might* prove useful.

Tried to upload a very small PHP test file:

Code: [Select]
<?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:

Quote
Warning: 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?!

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,265
  • Gender: Male
    • Kindred-999 on GitHub
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #16 on: May 25, 2017, 06:14:23 AM »
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.

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #17 on: May 25, 2017, 06:29:39 AM »
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.

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 30,309
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #18 on: May 25, 2017, 06:13:19 PM »
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

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Unable to connect to database after applying 2.0.14 patch
« Reply #19 on: May 29, 2017, 05:31:58 AM »
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.