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.
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.
- 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 require acme/sdk:^4.0 # last line that supports php 8.1Confirm the effective PHP and constraints
- Run
php -vin CI to see the actual runner PHP. - Run
composer why-not php 8.3to see what raises the requirement. - Align
config.platform.phpand 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.phpto the production target and review it on upgrades.