News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF database upgrade issue (php7+)

Started by huns, October 10, 2017, 10:37:21 AM

Previous topic - Next topic

huns

So I have seen errors in the Log. When I checked the page that threw the error, it said my database is older and I should upgrade. So be it.

The upgrade did not go seamlessly.

Quote[proxy_fcgi:error] [pid 4708:tid 139985273456384] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function set_magic_quotes_runtime() in /var/www/upgrade.php:812\nStack trace:\n#0 /var/www/upgrade.php(122): loadEssentialData()\n#1 {main}\n  thrown in /var/www/upgrade.php on line 812\n'

But I found this topic:
https://www.simplemachines.org/community/index.php?topic=554283.0

I did this edit:
Quote"add this in upgrade.php
before line 812:
if (function_exists ('set_magic_quotes_runtime'))"

And then the upgrade kinda run, but at the end it resulted in an 500 error again. Here is the error:
Quote[proxy_fcgi:error] [pid 4708:tid 139985273456384] [client ] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: session_var in /var/www/Sources/Load.php on line 1604\nPHP message: PHP Notice:  Undefined index: session_value in /var/www/Sources/Load.php on line 1605\nPHP message: PHP Notice:  Undefined index: htmlspecialchars in /var/www/Sources/Load.php on line 1607\nPHP message: PHP Fatal error:  Uncaught Error: Function name must be a string in /var/www/Sources/Load.php:1607\nStack trace:\n#0 /var/www/Sources/Errors.php(288): loadTheme()\n#1 /var/www/Sources/Errors.php(161): setup_fatal_error_context('Incorrect strin...')\n#2 /var/www/Sources/Subs-Db-mysql.php(1423): fatal_error('Incorrect strin...', false)\n#3 /var/www/Sources/Subs-Db-mysql.php(1171): SMF_DB_MySQLi->error('\\n\\t\\t\\tUPDATE qsm_...', Object(mysqli))\n#4 /var/www/Sources/ScheduledTasks.php(1296): SMF_DB_MySQLi->query('substring', '\\n\\t\\t\\tUPDATE qsm_...', Array)\n#5 /var/www/upgrade.php(1941): scheduled_fetchSMfiles()\n#6 /var/www/upgrade.php(689): DeleteUpgrade()\n#7 {main}\n  thrown in /var/www/Sources/Load.php on line 1607\n', referer: https://website.com/upgrade.php?step=2&substep=0&data=...

Any ideas? :(

Illori

why are you running the upgrade script? what are you upgrading from and to?

huns

#2
Sorry for the late reply, I was not around my PC. And of course, thank you for the quick reply.

- I have been using SMF since 2.0.14. I kept using the large upgrade scripts to 2.07 or something like that. Then I switched to these Package Manager zip packages.
- Our forum was running the latest version (2.0.14), all is fine. But I never really went into the Log or checked it.
- So I went into the Log and it said something about PHP error and it was a link to "what's new" or something like that.
- Clicked the link, and the page said "your installation is new but your database is old, use the upgrade script..."
- Went and grabbed the full package, put it into the folder. Ran it.
- Error 500.
- Found the topic I posted, with a fix (basically an if that the script will just skip that command if it's not available.)
- As I wrote the script then ran a bit forward, but died on me at the very end. At the delete part more or less.
- Removed the upgrade.php after this "hiccup" and all seems well.

But it would be still great to be able to run the whole script without issues.
I reckon it's my PHP7.0 that I use. SMF itself runs great on it, but the upgrade script seems to be a bit outdated (not so 7.0 compatible.) 7.1 breaks SMF I know that, I rolled back to 7.0 once I gave it a try.

btw Stack information:
php: 7.0.22-0ubuntu0.17.04.1
http: 2.4.27-6.1+ubuntu17.04.1+deb.sury.org+1
ubuntu: 17.04
mysql: 5.7.19-0ubuntu0.17.04.1

I know, bit way too new, but we had to upgrade our stack. I would not have done it before 2.0.14, but it claimed to have full php7 support - and it also worked, so I went along. It worked great so far and even now after the botched upgrade it works fine as far as I can tell...

Update: Edited my post to reflect reality. I said I used 7.1 php, but it's 7.0 only.

Update #2: Yay for being lazy and never closing tabs.
This was the original message:

QuoteExpression #1 of ORDER BY clause is not in SELECT list, references column 'ourdatabase.t.id_last_msg' which is not in SELECT list; this is incompatible with DISTINCT
File: /var/www/Sources/Recent.php
Line: 1103

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.14, while your database is at version 2.0.9. The above error might possibly go away if you execute the latest version of upgrade.php.


Kindred

The database version message is a red herring...  it's a generic message and is not actually correct. There have been no database changes in 2.0.x
Слaва
Украинi

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."

Bob Perry of Web Presence Consulting

If it were me, I'd go into cpanel backend and back down the PHP version number to 5.6.3.xx, reupload the large upgrade package and do the manual upgrade a second time...

Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

huns

@Kindred: Well, but the log was full of errors, and if I visited a page like "last activity" it had just the php error saying I should upgrade my SMF. Having full blown errors and traces exposed to potential attackers did not seem like a good idea.

@Bob: It's a full blown machine and the whole stack had to be upgraded for HTTP/2 support. I don't think the old php would support the new Apache versions (or reverse, but you get the idea.) Reinstalling the entire machine and removing our http/2 support once again to support SMF.. but yeah it would be just as broken I guess. I would have to reinstall it somehow while keeping all our data... does not sound too much fun to me.

---

Since then our forums have been running in this half-broken state. Guess this is the end of our long run with Simple Machines Forum.
It was a nice ride, but I guess everything comes to an end at some point.
I will explore our options (time is running out, as soon as the next update is out with sec fixes we must move ASAP). So far I saw phpBB picked up some speed and there is NodeBB and Discourse too. Guess we will just have a vote about it or something. I'll miss ya SMF. :(

Arantor

It's nothing to do with PHP 7 whatsoever. I really wish people wouldn't make such pronouncements without understanding what's actually at fault here.

It's the fact you've upgraded to MySQL 5.7 after 5.7.5 and by default MySQL 5.7.5 runs more strictly than MySQL used to (e.g. 5.6), so things that were previously fine are now broken.

Need to remove the ONLY_FULL_GROUP_BY option from the SQL mode configuration in MySQL to fix it - or rewrite the offending queries.

boardhead

Just to be specific:  For MySQL 5.7.21 this is the option I added when launching mysqld to fix this:

--sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

(ie. all the default modes except ONLY_FULL_GROUP_BY)

- Phil

Advertisement: