I have ext-fileinfo but Composer says it is missing

Windows users: just edit php.ini and uncomment this line:

extension=php_fileinfo.dll

Remember to restart Apache for new php.ini to take effect.


Apparently it is because there are separate php.ini files for web/apache and CLI and as composer uses the CLI and phpinfo() uses the main php.ini the problem occurs.

If you run php -m in CLI and don't see the module's name you should find the CLI php.ini (in my case php-cli.ini and add the extension. e.g. extension=php_fileinfo.dll


I have the same problem. Fixed now.
you can also uncomment this line

extension=php_fileinfo.dll  

in the following files:

  1. php.ini-development
  2. php.ini-production

Please don't forget to restart your Apache.
Hope this will help.


For me it was different using php 7.4.x and Windows 10.

I checked which php.ini file is used by PHP in CLI mode with php --ini.

It showed C:\php7\php.ini - where I previously unzipped PHP (and also pointed Composer there).

Then I needed to uncomment extension=fileinfo in that file.


Depending on your platform, there may be more php.ini, if you are using Wamp, then there are two:

  • wamp\bin\php\php5.4.3\php.ini
  • wamp\bin\apache\Apache2.4.4\bin\php.ini

Make sure the extension is uncomented in both and then restart apache again.