Skip to content
Latchkey

Composer: This Package Requires php >= X but Your PHP Is Lower in CI

Each package declares a PHP version constraint. When the runner PHP is older than a (direct or transitive) package requires, Composer cannot resolve an installable set and reports the version conflict against your PHP.

What this error means

Composer install/update fails saying a package requires a higher PHP than the runner provides, e.g. "requires php >=8.2.0 -> your php version (8.1.7) does not satisfy that requirement". php -v confirms the runner is on the older version.

composer
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - acme/sdk 5.0.0 requires php >=8.2 -> your php version (8.1.7; ...) does
      not satisfy that requirement.

Common causes

The runner PHP is older than a dependency needs

A direct or upgraded transitive package raised its minimum PHP. The CI runner is still on an older PHP, so the constraint cannot be satisfied.

CI PHP drifted from the target

The workflow pins an older php-version than the project now targets, so installs that pass locally fail in CI.

How to fix it

Upgrade the CI PHP to a supported version

Bump the runner PHP to satisfy the package constraint.

php
- uses: shivammathur/setup-php@v2
  with:
    php-version: '8.3'

Or pin a package release compatible with your PHP

If you cannot upgrade PHP yet, require a version of the package that still supports it.

composer
composer require acme/sdk:^4.0   # last line that supports php 8.1

Confirm the effective PHP and constraints

  1. Run php -v in CI to see the actual runner PHP.
  2. Run composer why-not php 8.3 to see what raises the requirement.
  3. Align config.platform.php and the CI PHP with your real target.

How to prevent it

  • Keep CI PHP aligned with the lowest PHP you actually support.
  • Test a PHP version matrix so a dependency PHP bump surfaces early.
  • Set config.platform.php to the production target and review it on upgrades.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →