Composer says your requirements could not be resolved: PHP version and missing extensions

Composer installs libraries and, before doing so, checks that the PHP it runs on meets what each one demands. The message “Your requirements could not be resolved to an installable set of packages” means the PHP Composer sees is not the one the project asks for: either the version is too old, or an extension is missing. Nearly always the problem is Composer using a different PHP from the site’s. How to get Composer is in Composer on shared hosting.

Reading the message

What the message says It means
requires php ^8.1 but your php version (7.4.x) does not satisfy that requirement The PHP version Composer uses is older than the project asks for.
requires ext-intl * but it is missing from your system The extension (here, intl) is missing in the PHP Composer uses.
Composer detected issues in your platform It installed, but on running the site it found that the site’s PHP does not meet what the libraries require.

Fixing it, step by step

1 See which PHP Composer is using. In the Terminal, php -v. The command-line PHP may differ from the one you picked for the site in Select PHP Version. See when php -v shows another version.
2 Run Composer with the right PHP, by full path: /opt/alt/php82/usr/bin/php composer.phar install (swap 82 for the version you want, without the dot).
3 If an extension is missing, switch it on for that version in Select PHP Version. See switching a PHP extension on or off. To see what Composer sees, run php composer.phar show --platform.
4 If the site’s PHP version really is old, raise it (carefully, with a test) or use older versions of the libraries. See changing your PHP version without breaking the site.
5 If the composer.lock file was made on another machine, it may demand newer versions than your server can run. Instead of forcing it, generate the file again on your computer, naming the target version in config.platform.php of composer.json, and upload the result.
Avoid --ignore-platform-reqs as a fix. The option silences Composer, but the library still demands the version PHP does not have, and the error moves from the install to the site. It is for a test, not for production.
The libraries Composer installs are yours. Our support looks at the server (PHP version, extensions, limits), but does not repair library code: the boundary is in how far our support goes. For a whole application, see getting a Laravel application running.

A requirements message you cannot make sense of? Send us the full text and the project folder.

Open a support ticket

SEE ALSO

Composer on shared hosting: installing it and running it

Which PHP version should your site use

Switching a PHP extension on or off in Select PHP Version

Getting a Laravel application running

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.59/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?