Builder suddenly uses PHP 8.4.0RC1 instead of PHP 8.3 and composer fails

Hi,

My deploys suddenly stopped working. I just upgraded from Laravel 10 to 11 but I’m not sure that’s related. It fails both on the depot builder as well as my local builder.

I don’t know why, but it seems PHP8.4.0RC1 is used instead of 8.3, which I have specified in my Dockerfile, fly.toml and composer.json. Other than the upgrade to Laravel 11, I haven’t changed anything else.

The command I ran:
fly deploy

This is the error:

 => ERROR [base 4/5] RUN composer install --optimize-autoloader --no-dev     && mkdir -p storage/logs     && php artisan optimize:clear     && chown -R www-data:www-data /var/www/html     && sed -i 's/pr  1.4s
------
 > [base 4/5] RUN composer install --optimize-autoloader --no-dev     && mkdir -p storage/logs     && php artisan optimize:clear     && chown -R www-data:www-data /var/www/html     && sed -i 's/protected \$proxies/protected \$proxies = "*"/g' src/App/Http/Middleware/TrustProxies.php     && echo "MAILTO=""\n* * * * * www-data /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel     && cp .fly/entrypoint.sh /entrypoint     && chmod +x /entrypoint     && apt-get -y remove php8.3-swoole:
1.168 Installing dependencies from lock file
1.207 Verifying lock file contents can be installed on current platform.
1.335 Your lock file does not contain a compatible set of packages. Please run composer update.
1.335
1.335   Problem 1
1.335     - Root composer.json requires php 8.3.* but your php version (8.4.0RC1) does not satisfy that requirement.
1.335   Problem 2
1.335     - Root composer.json requires PHP extension ext-intl * but it is missing from your system. Install or enable PHP's intl extension.
1.335   Problem 3
1.335     - aws/aws-sdk-php is locked to version 3.324.5 and an update of this package was not requested.
1.335     - aws/aws-sdk-php 3.324.5 requires ext-simplexml * -> it is missing from your system. Install or enable PHP's simplexml extension.
1.335   Problem 4
1.335     - inertiajs/inertia-laravel is locked to version v1.3.0 and an update of this package was not requested.
1.335     - inertiajs/inertia-laravel v1.3.0 requires php ^7.3|~8.0.0|~8.1.0|~8.2.0|~8.3.0 -> your php version (8.4.0RC1) does not satisfy that requirement.
1.335   Problem 5
1.335     - openspout/openspout is locked to version v4.26.0 and an update of this package was not requested.
1.335     - openspout/openspout v4.26.0 requires ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
1.335   Problem 6
1.335     - sentry/sentry is locked to version 4.9.0 and an update of this package was not requested.
1.335     - sentry/sentry 4.9.0 requires ext-curl * -> it is missing from your system. Install or enable PHP's curl extension.
1.335   Problem 7
1.335     - tijsverkoyen/css-to-inline-styles is locked to version v2.2.7 and an update of this package was not requested.
1.335     - tijsverkoyen/css-to-inline-styles v2.2.7 requires ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
1.335   Problem 8
1.335     - league/flysystem-aws-s3-v3 is locked to version 3.29.0 and an update of this package was not requested.
1.335     - aws/aws-sdk-php 3.324.5 requires ext-simplexml * -> it is missing from your system. Install or enable PHP's simplexml extension.
1.335     - league/flysystem-aws-s3-v3 3.29.0 requires aws/aws-sdk-php ^3.295.10 -> satisfiable by aws/aws-sdk-php[3.324.5].
1.335
1.335 To enable extensions, verify that they are enabled in your .ini files:
1.335     - /etc/php/8.4/cli/php.ini
1.335     - /etc/php/8.4/cli/conf.d/10-opcache.ini
1.335     - /etc/php/8.4/cli/conf.d/10-pdo.ini
1.335     - /etc/php/8.4/cli/conf.d/20-calendar.ini
1.335     - /etc/php/8.4/cli/conf.d/20-ctype.ini
1.335     - /etc/php/8.4/cli/conf.d/20-excimer.ini
1.335     - /etc/php/8.4/cli/conf.d/20-exif.ini
1.335     - /etc/php/8.4/cli/conf.d/20-ffi.ini
1.335     - /etc/php/8.4/cli/conf.d/20-fileinfo.ini
1.335     - /etc/php/8.4/cli/conf.d/20-ftp.ini
1.335     - /etc/php/8.4/cli/conf.d/20-gettext.ini
1.335     - /etc/php/8.4/cli/conf.d/20-iconv.ini
1.335     - /etc/php/8.4/cli/conf.d/20-phar.ini
1.335     - /etc/php/8.4/cli/conf.d/20-posix.ini
1.335     - /etc/php/8.4/cli/conf.d/20-readline.ini
1.335     - /etc/php/8.4/cli/conf.d/20-shmop.ini
1.335     - /etc/php/8.4/cli/conf.d/20-sockets.ini
1.335     - /etc/php/8.4/cli/conf.d/20-sysvmsg.ini
1.335     - /etc/php/8.4/cli/conf.d/20-sysvsem.ini
1.335     - /etc/php/8.4/cli/conf.d/20-sysvshm.ini
1.335     - /etc/php/8.4/cli/conf.d/20-tokenizer.ini
1.335 You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
1.335 Alternatively, you can run Composer with `--ignore-platform-req=ext-intl --ignore-platform-req=ext-simplexml --ignore-platform-req=ext-dom --ignore-platform-req=ext-curl` to temporarily ignore these required extensions.
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c composer install --optimize-autoloader --no-dev     && mkdir -p storage/logs     && php artisan optimize:clear     && chown -R www-data:www-data /var/www/html     && sed -i 's/protected \\$proxies/protected \\$proxies = \"*\"/g' src/App/Http/Middleware/TrustProxies.php     && echo \"MAILTO=\\\"\\\"\\n* * * * * www-data /usr/bin/php /var/www/html/artisan schedule:run\" > /etc/cron.d/laravel     && cp .fly/entrypoint.sh /entrypoint     && chmod +x /entrypoint     && apt-get -y remove php${PHP_VERSION}-swoole" did not complete successfully: exit code: 2

My fly.toml file

# Truncated...
[build]
  dockerfile = 'Dockerfile'

  [build.args]
    NODE_VERSION = '20'
    PHP_VERSION = '8.3'
# Truncated...

My Dockerfile, up until the composer command where it fails:

# syntax = docker/dockerfile:experimental

# Default to PHP 8.3, but we attempt to match
# the PHP version from the user (wherever `flyctl launch` is run)
# Valid version values are PHP 7.4+
ARG PHP_VERSION=8.3
ARG NODE_VERSION=20
FROM fideloper/fly-laravel:${PHP_VERSION} as base

# PHP_VERSION needs to be repeated here
# See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PHP_VERSION

LABEL fly_launch_runtime="laravel"

# Install dependencies (imagick)
RUN apt-get update && apt-get install -y \
    php8.3-imagick php-excimer \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# copy application code, skipping files based on .dockerignore
COPY . /var/www/html

RUN composer install --optimize-autoloader --no-dev \
    && mkdir -p storage/logs \
    && php artisan optimize:clear \
    && chown -R www-data:www-data /var/www/html \
    && sed -i 's/protected \$proxies/protected \$proxies = "*"/g' src/App/Http/Middleware/TrustProxies.php \
    && echo "MAILTO=\"\"\n* * * * * www-data /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel \
    && cp .fly/entrypoint.sh /entrypoint \
    && chmod +x /entrypoint \
    && apt-get -y remove php${PHP_VERSION}-swoole

# Truncated...

composer.json

...
"require": {
  "php": "8.3.*",
  "ext-intl": "*",
   ...

Any help is much appreciated.

Thank you,

Floris

I looked at this a bit - it turns out the php-excimer package defines php8.4 as a dependency and thus installs it for you.

Use package php8.3-excimer instead in your Dockerfile, and that should fix it up.

3 Likes

Thank you for the quick response. This indeed fixes the issue. Many thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.