Fatal Error: composer.lock was created for PHP version 7.4 or higher but the current PHP version is 7.3.11

Fatal Error: composer.lock was created for PHP version 7.4 or higher but the current PHP version is 7.3.11

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Fatal Error: composer.lock was created for PHP version 7.4 or higher but the current PHP version is 7.3.11

This specific error message appears when there is a mismatch between the PHP binaries used to generate dependency files and the PHP binaries currently running in your environment. The composer.lock file acts as a contract; it records exactly which versions of packages were resolved and, crucially, what minimum PHP version was required to install them. If you attempt to load an application with a PHP binary that is older than this requirement, PHP throws a fatal error before the framework can even initialize.

In your scenario, the discrepancy lies between two different PHP installations running on the same machine. You are using XAMPP, which bundles its own PHP interpreter (version 7.3.11) to serve web requests via Apache or Nginx. However, you are executing Composer commands using a separate, system-wide installation of PHP CLI (version 7.4.0).

When you ran composer create-project symfony/skeleton my_project, the Composer CLI detected your system PHP version (7.4.0) and generated a composer.lock file enforcing PHP 7.4 requirements. Later, when you accessed localhost/my_project/public/, the request was handled by XAMPP's bundled PHP 7.3.11. Upon loading the application, this older binary checked the lock file, saw it required PHP 7.4+, and halted execution immediately.

Modifying the symfony.lock file to reflect a lower version number is not a valid solution. That file tracks Symfony framework dependencies (like bundles or services), not the underlying PHP engine version. The PHP requirement is strictly enforced by Composer based on the package definitions in composer.json, which are derived from Packagist metadata. Changing that lock file does not alter the fact that the installed packages (such as symfony/console or doctrine/dbal) contain code incompatible with PHP 7.3.11.

To resolve this, you must align your environment so that the PHP version running the web server matches the version used by Composer. There are three primary approaches to fixing this:

Option 1: Update XAMPP

The most straightforward fix is to upgrade the PHP installation bundled with XAMPP from 7.3.11 to a version compatible with your current Symfony project (PHP 7.4 or higher). You can download the latest XAMPP package from https://www.apachefriends.org/, extract it over your existing installation, and ensure the php directory points to the new version. After updating, restart the Apache service in the XAMPP Control Panel.

Option 2: Align Composer with XAMPP

If you prefer to keep XAMPP's older PHP version for legacy reasons, you must force Composer to use that same binary when creating or updating the project. You can do this by setting the COMPOSER_RUNTIME_BINARY environment variable or explicitly passing the path to the XAMPP PHP executable in your terminal:

composer create-project symfony/skeleton my_project -d "C:/xampp/php/bin/php"

Alternatively, you can install a version of Symfony that supports PHP 7.3. However, be aware that modern Symfony versions often drop support for older PHP branches to ensure security and performance. Downgrading the framework might introduce compatibility issues with other packages you intend to add later.

Option 3: Use XAMPP's PHP for CLI

You can configure your command line environment to use XAMPP's PHP instead of your system-wide PHP. On Windows, this involves editing the PATH environment variable to prioritize the path to C:\xampp\php\php.exe over your system PHP location. Once updated, run php -v in CLI again; if it reports 7.3.11, your Composer commands will subsequently use that binary, and the version mismatch error will disappear.

It is important to note that running different PHP versions for CLI and Web simultaneously on a single machine is a common source of confusion. While this setup allows you to test compatibility across versions, it introduces complexity when managing dependencies. For production environments or stable development workflows, relying on a unified stack—where the web server and CLI tools share the same PHP installation—is generally recommended to prevent subtle version conflicts.

Our network