Composer Error: "PHP Extension Fileinfo Is Missing from Your System"

Composer error: PHP extension fileinfo is missing from your system

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

requires ext-fileinfo. How do I add that into my composer.json file?

Nothing to do with your composer.json.

You need to install & enable FileInfo PHP extension, which is installed by default starting with PHP 5.3.0. Versions prior to 5.3+ may use the discontinued PECL extension.

To enable FileInfo extension, you need to edit your php.ini and change a single line.

  1. Locate the line:

    ;extension=php_fileinfo.dll
  2. Remove the starting comment:

    extension=php_fileinfo.dll

To find out where your php.ini is located, you can run the following command from a terminal:

$ php --ini

and search for "Loaded Configuration File".

Please note that the PHP CLI can load a different php.ini file than the web, so don't rely on the path provided in phpinfo(). Run the command specified above in a terminal to find out the file loaded by PHP CLI.

Trying to create new Laravel project this error came up

I found the answer,
the problem was that I was removing ; before extension = fileinfo from php.ini inside PHP folder in xampp folder "c:/xampp/php/"
but I didn't remove it from "c:/php/php.ini".

Laravel php artisan serve not doing anything and project not being created properly (windows 10)

You can solve the problem by editing your php.ini file in your Windows, following these steps :

  1. Press the Windows logo (bottom left)
  2. Type Notepad on the search field
  3. Click right on the Notepad and select "Run as administrator"
  4. From Notepad, click on "File", then "Open" and paste the path of your php.ini file in the address bar (my case was C:\Program Files\PHP\v7.4\php.ini)
  5. When your file is open in your Notepad as administrator, remove the ; before the line extension=php_fileinfo.dll. If you can't find this line, then simply add it after the others php extension.
  6. Save
  7. Restart your computer
  8. Try again

How can I install extension php_fileinfo in my php.ini in Windows 10

I found how to edit my php.ini in my Windows, following this link :

  1. Press the Windows logo (bottom left)
  2. Type Notepad on the search field
  3. Click right on the Notepad and select Run as administrator
  4. From Notepad, click on File > Open and paste C:\Program Files\PHP\v7.4\php.ini
  5. Edit
  6. Save


Related Topics



Leave a reply



Submit