Upgrading from Sage 9 to 10 (Because of PHP 8)

Hi everyone, I’ve recently upgraded to latest Trellis which also led me to upgrade to Ubuntu 20.04 and PHP 8 and now I’ve found my Sage 9 site no longer works because of PHP 8. I tried to find some documentation to see how to upgrade to Sage 10 (or make Sage 9 support PHP 8) however didn’t find any solutions yet. I imagine this must be a common question now, so does anyone have any advice?

Thanks!
Kris

1 Like

Sage is generally not meant to be “upgraded.” In what was does your existing theme not work on PHP 8?

1 Like

First Sage 9 composer install fails because of the required libs (illuminate/support, etc) don’t seem to support PHP 8. Haven’t gotten further than that yet.

I’ve done it multiple times, and it is a heavy and cumbersome process, but it is worth it, in my opinion. Set aside 2 or 3 hours at least.

Just install a new Sage 10 theme and use kdiff3 to compare folder by folder the differences. While seeing the differences you will know what to adapt and what to discard.

Good luck!

2 Likes

Thanks! It’s encouraging to hear it’s at least possible :smiley:

One curious discovery has been that the PHP version installed by Trellis and reported by WP’s dashboard is different than the PHP version I get when running php -v on the server (which composer uses to run apparently). So I’ve managed to get composer working (fingers crossed) by downgrading the PHP version in /usr/bin/php to 7.4 while serving the deployed website itself with PHP 8.1…

This does feel terribly brittle though!

Like @alwaysblank said, we never recommend upgrading Sage since it’s a starter theme.

Instead of trying to upgrade from 9 to 10, and you absolutely must move the site to PHP 8, why not try to first update the dependencies and their required changes in Sage 9? An example PR from the sage-lib repo for bumping Laravel deps: Update to Laravel 7 by mcaskill · Pull Request #8 · roots/sage-lib · GitHub

Also worth noting that WordPress is not fully compatible with PHP 8 yet: WordPress 5.9 and PHP 8.0-8.1 – Make WordPress Core

That’s true, 8.1 gave me a lot of headaches, while 8.0 for the moment seems it’s working fine.

I guess the upgrade depends on how many hours are you to spend with the old project. If it’s some simple changes, it’s better to update composer and yarn. But if it’s something more complex, I think that Sage 10 is on a way different level from Sage 9, and it makes it worthwhile (log1x packages being a big part of its worth).

This topic was automatically closed after 42 days. New replies are no longer allowed.