Skip to content

Composer reports incorrect PHP version in php:7.4.*-fpm-alpine3.15 #1263

@josefsabl

Description

@josefsabl

Now this is very strange. Although php -v reports correct php version (7.4.28) when trying to use composer to install dependencies it tells me I have PHP 8.0.16.

Steps to reproduce:

  1. Run the container
docker run -it php:7.4.28-fpm-alpine3.15 /bin/sh
  1. Run this script
apk add composer
echo '{
  "name": "test/test",
  "version": "0.0",
  "authors": [],
  "require": {
    "php": "^7.4.0"
  }
}' > composer.json
composer install
  1. Result:
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires php ^7.4.0 but your php version (8.0.16) does not satisfy that requirement.

The problem seems to be with the latest version of alpine and not the php version. I tried for two last versions of both:

php:7.4.28-fpm-alpine3.15 bug
php:7.4.27-fpm-alpine3.15 bug
php:7.4.28-fpm-alpine3.14 ok
php:7.4.27-fpm-alpine3.14 ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions