Author Topic: SMF database upgrade issue (php7+)  (Read 285 times)

Offline huns

  • Semi-Newbie
  • *
  • Posts: 41
SMF database upgrade issue (php7+)
« on: October 10, 2017, 10:37:21 AM »
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.

[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:

I did this edit:
"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:
[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:

Any ideas? :(

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 47,657
Re: SMF database upgrade issue (php7+)
« Reply #1 on: October 10, 2017, 10:40:44 AM »
why are you running the upgrade script? what are you upgrading from and to?

Offline huns

  • Semi-Newbie
  • *
  • Posts: 41
Re: SMF database upgrade issue (php7+)
« Reply #2 on: October 10, 2017, 12:39:19 PM »
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
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:

Expression #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.

« Last Edit: October 10, 2017, 12:55:18 PM by huns »

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,905
  • Gender: Male
    • Kindred-999 on GitHub
Re: SMF database upgrade issue (php7+)
« Reply #3 on: October 10, 2017, 08:30:04 PM »
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
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 Bob Perry of Web Presence Consulting

  • Sr. Member
  • ****
  • Posts: 946
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • on LinkedIn
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: SMF database upgrade issue (php7+)
« Reply #4 on: October 11, 2017, 01:28:25 AM »
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