How to PhP version errors in DevKinsta while using acorn

I’m currently experimenting with Kinsta and it’s local dev environment, Devkinsta for the first time. I’ve been using WP Engine for years and love them 99% of the time. However, I’m currently branching out and using Bedrock, which WPE does not support.

Sage10 requires Acorn to work. It’s a framework that lets you utilize Laravel packets and functionality and requires PHP 8 or higher.

While setting up Acorn, i got an error on my machine that i didn’t have the right version of PhP installed. My machine had version 8.0.18 installed, but the error was saying that my version was below 8.

After some digging, I learned that when you choose a custom install in DevKinsta, it actually uses 7.4 by default. I’ll run through the steps to get it set up properly.

First, get inside the devkinsta container as root.

docker exec -it devkinsta_fpm bash

You need to access the container bash as the root agent, not the www-data agent, so that you have sufficient permissions to update the PHP. Next you need to run the update-alternatives command:

update-alternatives --config php

This will print out a list of versions of PHP that are installed and ask you to type a number for the version you want to switch to.

This post is basically a combination this thread and this.