I upgraded my server to PHP 8.1.22 in order to start a new Craft 4 site, and one (but not all) of my existing Craft 3 (3.6.17) sites is giving me the following error. How do I resolve this error? See error screenshot below:
1 Answer
Craft version 3.6.17 was released in June 2021, while PHP 8.1 had its first stable release in November 2021. The latest PHP version Craft could support at that point was 8.0, so you're running this version of Craft on an unsupported PHP version. That's why your getting errors.
To fix this issue and prepare for the Craft 4 update, first update to the last stable 3.x version, as mentioned in the update guide. This one will support newer PHP versions.
If you can't use the Craft binary (php craft update all
) because it's giving you errors as well, you can use Composer to update the library instead. Then run php craft up
to execute any required migrations. However, the better approach is to do the update first, and then bump your PHP version.
-
Thanks for the answer, I will give it a shot. The weird thing is though I have two other sites that are both running 3.6.17 and still work fine after updating the PHP. Commented Oct 16, 2023 at 14:56
-
1@JustinKendall The specific error is coming from ImageMagick, maybe the other sites are using GD? Anyway, updating the Craft version is recommended in either case, there could be other errors that you are not seeing due to the version mismatch. And it's required before you update to Craft 4 anyway. Commented Oct 16, 2023 at 15:12