Trying to create new Laravel project this error came up

Trying to create new Laravel project this error came up

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

Stefan Bogdanescu

Founder & Senior Architect

The ext-fileinfo Extension Trap in Laravel Installation

You are encountering a dependency resolution failure that stems from a missing system-level extension rather than an issue within your Composer configuration or codebase. When running composer create-project laravel/laravel newProject4, the tool attempts to resolve the requirements for laravel/framework ^8.54. This specific version of Laravel requires league/flysystem version 1.x as a dependency. In turn, league/flysystem ^1.1 explicitly declares a hard requirement for the PHP extension ext-fileinfo.

The error message it is missing from your system indicates that while the Composer JSON file might be syntactically correct, the underlying PHP runtime on your machine does not have this extension loaded. This is a common stumbling block for developers running Windows local environments, particularly those using standalone PHP installations or shared hosting configurations where extensions are not pre-enabled.

To confirm whether the extension is actually missing versus being misconfigured, you can inspect the active configuration by running php --ini inside your terminal. As noted in your edit, this command reveals that the loaded configuration file is C:\php\php.ini. The absence of additional parsed .ini files suggests that any required extensions must be explicitly commented out or enabled within this primary configuration file.

Enabling the Extension

The most direct solution is to manually enable the fileinfo extension in your PHP configuration. Since you identified C:\php\php.ini as the loaded file, you need to open this specific path in a text editor with administrative privileges.

Search for the line containing extension=fileinfo. You will likely find one of two scenarios:

  1. The line is commented out and looks like ;extension=fileinfo.
  2. The line is missing entirely.

To enable it, remove the semicolon at the start of the line or add the line if it is missing. Ensure the path to the extension DLL matches what PHP expects. On Windows, this is often located in the same directory as your php.ini file (e.g., C:\php\ext\php_fileinfo.dll).

After making these changes, save the file and restart your terminal or IDE's PHP CLI tool. The change takes effect immediately for new processes; you do not need to restart your operating system, but you must ensure the PHP process running Composer picks up the updated configuration.

Verifying the Fix

Before attempting to run composer create-project again, verify that the extension is now active. Run the following command in your terminal:

php -m | findstr fileinfo

If this returns fileinfo, the extension is successfully loaded. If you still see the original error after enabling the extension, double-check that Composer is invoking the same PHP binary you just modified. Sometimes development environments have multiple PHP versions installed (e.g., via XAMPP, WAMP, or a standalone installer), and Composer might be pointing to an older version that doesn't reflect your manual changes.

Ensure your composer.json does not lock an older version of PHP that predates the availability of this extension in the specific build you are using. While modern PHP 8.x builds on Windows almost always include fileinfo, legacy setups or custom distributions might require explicit configuration.

Once the extension is confirmed active, re-run your installation command:

composer create-project laravel/laravel newProject4

If the dependency resolver can now satisfy the requirement for league/flysystem without throwing a missing extension error, your project will initialize correctly. If issues persist, check the Composer output for any warnings regarding PHP version mismatches, as Laravel 8.x requires PHP 7.2.5 or higher, and the specific build of PHP must support the required extensions.

Our network