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.
Locate the line:
;extension=php_fileinfo.dll
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 :
- Press the Windows logo (bottom left)
- Type Notepad on the search field
- Click right on the Notepad and select "Run as administrator"
- 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
) - When your file is open in your Notepad as administrator, remove the
;
before the lineextension=php_fileinfo.dll
. If you can't find this line, then simply add it after the others php extension. - Save
- Restart your computer
- 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 :
- Press the Windows logo (bottom left)
- Type
Notepad
on the search field - Click right on the Notepad and select Run as administrator
- From Notepad, click on File > Open and paste
C:\Program Files\PHP\v7.4\php.ini
- Edit
- Save
Related Topics
Calculating Days of Week Given a Week Number
PHP Fatal Error Failed Opening Required File
PHP - How to Best Determine If the Current Invocation Is from Cli or Web Server
Composer Warning: Openssl Extension Is Missing. How to Enable in Wamp
PHP Check If File Contains a String
Symfony2 Conceptual Issue: General Bundles Vs. Specific Ones
How to Embed Youtube Videos in PHP
PHP How to Get Local Ip of System
Session Data Lost in Chrome Only
Why Doesn't MySQL Support Millisecond/Microsecond Precision
Why Is This PHP Call to Json_Encode Silently Failing - Inability to Handle Single Quotes
How to Clear Apc Cache Entries
Fastest Way to Convert String to Integer in PHP
Converting MySQL Result Array to Json
Download Files in Laravel Using Response::Download
How to Delete All Cookies of My Website in PHP
What Do I Need to Store in the PHP Session When User Logged In