since almost 1 or 2 weeks ago my Shopify PHP app deployed on Fly.io gives me the error: "Your Composer dependencies require a PHP version '>= 8.2.0'. You are running 8.1.27."
Hmmm I thought we built PHP 8.3 base images, that should work in theory! But yeah, show the Docker image and fly.toml as it might be using a buildpack or something else.
So Fly works by building a Docker image and deploying that as a “real” VM (not a container, the docker image is just a convenient way to ship an application and its runtime- php in this case).
Your Dockerfile is using a setup that wasn’t generated by fly launch - in other words, our PHP (laravel, really) docs aren’t geared towards your (custom?) Dockerfile being used.
Solution
In this case, it’s likely that the following change to the Dockerfile will make it Just Work™ for you, using PHP 8.3:
- FROM php:8.1-fpm-alpine
+ FROM php:8.3-fpm-alpine
ARG SHOPIFY_API_KEY
# Remaining Dockerfile omitted for brevity
Last note
You may want to consider moving the APP_KEY and SHOPIFY_API_KEY environment variables to fly secrets (they’ll still look like environment variables to the PHP app, but they won’t be plaintext in the fly.toml file with secrets).
Very clear, thank you very much for the explanation and the tips!
(I would suggest adding a very brief sentence on the doc page to alert that the PHP version could depend on the Docker image in some cases to avoid dumb questions such as mine)