Ffile2fix
Sign in Get started

Fix "Composer detected issues in your platform" (PHP version)

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.29.

Composer 2 generates vendor/composer/platform_check.php, which runs on every request and stops the app if the running PHP is older than your installed packages need. The packages were installed for a newer PHP than the one serving the site.

Also appears as: Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.33. in /home/user/public_html/vendor/composer/platform_check.php on line 24 · Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: intl, sodium. · Composer detected issues in your platform: Your Composer dependencies require a 64-bit build of PHP.

Common causes

  • The site's PHP version in the hosting panel is older than the version vendor/ was built for
  • composer install or update ran with a newer CLI PHP (or on your laptop) than the web server uses
  • The host changed or downgraded the default PHP version, or the domain was moved to a new server
  • A .htaccess AddHandler/SetHandler line forces an older PHP version for that folder
  • A required extension (intl, sodium, gd) is missing for the web PHP even though the version is correct

How to fix it

  1. Compare the two versions. The message states the required version and the one 'You are running'. The fix is to make those match, not to hide the check.
  2. Switch the site's PHP version. In cPanel use MultiPHP Manager or Select PHP Version; on Hostinger use Advanced > PHP Configuration. Pick a version that meets the requirement, then reload the site.
  3. Look for a PHP handler in .htaccess. cPanel writes a block like AddHandler application/x-httpd-ea-php81 .php to .htaccess. An old copy left after a migration can override the panel setting; update or remove it.
  4. Or rebuild vendor/ for the server's PHP. If you cannot upgrade PHP, set config.platform.php to the server version and run composer update so Composer picks compatible package versions, then deploy the new composer.lock.
  5. Install with the same PHP as the web server. On the server, run Composer with the matching binary, e.g. /opt/cpanel/ea-php82/root/usr/bin/php /usr/local/bin/composer install --no-dev.
  6. Enable missing extensions. If the message lists extensions, enable them for the web PHP version in the hosting panel or install them on the VPS and restart PHP-FPM.

composer.json

{
  "require": {
    "php": "^8.1"
  },
  "config": {
    "platform": {
      "php": "8.1.29"
    }
  }
}

How to stop it happening again

  • Set config.platform.php in composer.json to the production PHP version
  • Keep SSH/CLI PHP and the website's PHP version the same
  • Check the PHP version in the panel before deploying a framework upgrade

Frequently asked questions

Can I disable the platform check?

You can with composer config platform-check false, but the check only exists to stop a worse failure. Packages that need PHP 8.2 will then fail with syntax or type errors instead, so fix the version mismatch.

Why does php -v show the right version but the site does not?

The command line and the web server can use different PHP binaries. The website's version is set in the hosting panel or .htaccess handler, and the CLI version comes from your shell PATH.

Where is this check located?

In vendor/composer/platform_check.php, generated by Composer 2 during install or dump-autoload. Editing it by hand is pointless because it is regenerated.