XF 2.2 Best upgrade path from PHP 5.6/XF 1.4.2 to PHP 8/XF 2.2

wwwicked

Active member
Hi, I'm trying to move vhosts and upgrade XenForo in the process.

My current (old) host is PHP 5.6.35 and I am on XenForo 1.4.2 (both quite old and unsupported).

The new host is PHP 8.0.7, and I want to upgrade all the way to the latest version of XenForo (huzzah!)

I have a localhost configured with PHP 7.4.

I've tried a straight import of my 1.4.2 SQL dump into both PHP 7.4 and 8.0. Unsurpisingly, neither work.

I've been hoping to avoid upgrading the live forum in place, but it seems that would be the best thing to do. I could potentially upgrade the current vhost to a newer PHP, but that might break the 1.4.2 forum.

So can anyone advise which would be the best stepping stone XenForo version?

I propose to upgrade in place on the live server (PHP 5.6), then take a SQL dump and import that into my PHP 7.4 or PHP 8.0 hosts to complete the rest of the upgrade.

Would XF 1.5.24 be suitable as the intermediate version?
 

Brogan

XenForo moderator
Staff member
The simplest way is to update PHP to 8.x, then upgrade XF to the latest version.

Do a test upgrade first so you know what to expect.
 

wwwicked

Active member
The simplest way is to update PHP to 8.x, then upgrade XF to the latest version.

Do a test upgrade first so you know what to expect.
But XF 1.4.2 doesn't work on PHP 8. I've already tried that; I can't even get a login to work.

Are you saying that if I upload the upgrade package it'll just bypass any of the XF 1.4.2 stuff and should work just fine?
 

Brogan

XenForo moderator
Staff member
Correct.
SImilarly, you can' t install XF 2.2 on PHP 5.

Both actions need to be done concurrently.

Doing so in a test instance will allow the existing site to continue running until you are ready to upgrade.
 

wwwicked

Active member
This worked fine on my PHP 7.4 localhost. But trying to upgrade on my PHP 8.0 host I get an error running upgrade to 2.0.0 Beta 7, step 1.

In 2000037-200b7.php line 21:

[E_WARNING] Trying to access array offset on value of type null

The line itself is:

PHP:
if (is_array($optionValue['messageParticipants']))

I've seen some similar errors linked to addons, but this doesn't appear to be addon specific.

The query preceding it results in zero rows:

SQL:
MariaDB [xenforo]> SELECT option_value FROM xf_option WHERE option_id = 'registrationWelcome';
Empty set (0.000 sec)

I don't think this is a data import problem as it's not there on my XF 1.4 installation either. Can I just set it to be an empty string?
 

Xon

Well-known member
I'ld recommend doing the XF upgrade using php 7.4, as it looks like the upgrade paths haven't been fully vetted.

To make this upgrade step work with php8, try patching that broken line to;
PHP:
$messageParticipants = $optionValue['messageParticipants'] ?? null;
if (is_array($messageParticipants))
 

wwwicked

Active member
I'ld recommend doing the XF upgrade using php 7.4, as it looks like the upgrade paths haven't been fully vetted.

To make this upgrade step work with php8, try patching that broken line to;
PHP:
$messageParticipants = $optionValue['messageParticipants'] ?? null;
if (is_array($messageParticipants))

Yeah, there's no PHP 7.4 alternative on my PHP 8.0 host.

I think maybe the solution is to take a fresh dump from the PHP 7.4 installation I've already upgraded on localhost, and import that into the new PHP 8.0 host.
 

Chris D

XenForo developer
Staff member
I'ld recommend doing the XF upgrade using php 7.4, as it looks like the upgrade paths haven't been fully vetted.

To make this upgrade step work with php8, try patching that broken line to;
PHP:
$messageParticipants = $optionValue['messageParticipants'] ?? null;
if (is_array($messageParticipants))
Side note: This code trips up on PHP 7.4 too. You'd need PHP 7.3 to workaround it.
 
Last edited:
  • Like
Reactions: Xon

Chris D

XenForo developer
Staff member
@Chris D shouldn't that be?
PHP:
if (isset($optionValue) && is_array($optionValue['messageParticipants']))
Potentially, the wider question is why $optionValue is null in the first place, and presumably that's because the option doesn't currently exist as we're upgrading from a version that didn't have it through a version that added it.
 

Chris D

XenForo developer
Staff member
I'ld recommend doing the XF upgrade using php 7.4, as it looks like the upgrade paths haven't been fully vetted.

To make this upgrade step work with php8, try patching that broken line to;
PHP:
$messageParticipants = $optionValue['messageParticipants'] ?? null;
if (is_array($messageParticipants))
Given the option value is likely empty because it hasn't been imported yet, I think this fix is probably the one.
 
  • Like
Reactions: Xon

Xon

Well-known member
Potentially, the wider question is why $optionValue is null in the first place, and presumably that's because the option doesn't currently exist as we're upgrading from a version that didn't have it through a version that added it.
I'm fairly sure this option was added in an XF2.0.0 beta, but it doesn't exist till after the upgrade steps finish running
 

Chris D

XenForo developer
Staff member
Exactly. It was added in XF 1.5 but we changed its format in XF 2.0. This step exists because of a bug in the 2.0 Alpha step. Ironically we protect against it in the 2.0.0 Alpha step but not the Beta 7 step.
 

wwwicked

Active member
Thanks @Xon and @Chris D , I went with editing the source file after all.

All upgrade steps have now run up to version 2.2.5 on my PHP 8.0 system.

I've a different problem now - logging in takes me to xf/login/login which is a 404 on my PHP 8.0 system, but a 303 (See Other) on my PHP 7.4 system. I think that's maybe because I normally use Apache, but the new host is Nginx.

I added the "location" directives from https://xenforo.com/docs/xf2/options/#nginx into my nginx.conf but that hasn't solved it.

Something to do with front controller/routing I guess - all URLs are 404.


Update: turned out I'd edited the wrong nginx.conf
 
Last edited:
Top