31

I'm trying to install Laravel package Intervention Image and when I run composer update:

Your requirements could not be resolved to an installable set of packages. Problem 1 - intervention/image 2.0.5 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - intervention/image 2.0.4 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - intervention/image 2.0.3 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - intervention/image 2.0.2 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - intervention/image 2.0.1 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - intervention/image 2.0.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system. - Installation request for intervention/image 2.* -> satisfiable by intervention/image[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5]. 

I have php 5.4 and the extension is enabled in php.ini, and in phpinfo():

 fileinfo fileinfo support enabled version 1.0.5 

and restarted apache... but still no luck.

0

13 Answers 13

54

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Works perfect for IIS.
I had trouble with this using PHP Tools for Visual Studio. I resolved it by using Process Monitor during a Composer run inside Visual Studio ("Install New Composer Packages…"). I found out which PHP.EXE this actually triggered and in turn which PHP.INI is actually used by the Composer call. After adding the extension to the correct PHP.INI, the Composer run succeeded.
32

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

5 Comments

I added the line to my php-cli.ini but am still having the problem after a server restart. I've uncommented the line in every php.ini file. Still no luck.
@americanknight does the module's name show up when you run php-m ?
No, it doesn't appear in the list. I'm running UniServer 11.6 on Windows 7.
I could not find php-cli.ini file. Where is it located?
type php --ini to see which ini file are being used by php
16

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.

Comments

11

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.

Comments

4

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.

1 Comment

I don't have any php.ini in my C:\Bitnami\wampstack-5.5.27-0\apache2\bin. Also in the phpinfo() says C:\Bitnami\wampstack-5.5.27-0\php\php.ini . In this file I have the extension uncommented but I still have the problem. Do you have any idea what the problem might be?
4

On Windows I had to add line extension=php_fileinfo.dll in my php.ini file

Comments

3

For PHP 8 the line in php.ini you want to uncomment is:

;extension=fileinfo 

to

extension=fileinfo 

Comments

2

I have this exactly same problem. Fixed by going to wamp/bin folder, and searching for .ini. You will find several php.ini files.

Edit the extension=php_fileinfo.dll line in all of them removing the ; at the begging of each. Restart WAMP, enter php -m in the command-line to check if fileinfo is there now.

Should work.

Comments

1

Uncomment extension=php_fileinfo.dll in php ini configuration files (php.ini-development if needed) And then if you're using XAMPP, use the apache shell. It can be loaded from XAMPP Control panel run php -m to verfy that extention is loaded. Then run composer install.

Comments

1

If anyone is wondering how to do this in cpanel (linux based) , just search select php version in search box and click on it and next screen you will your current php version and next you see lots checkboxes with some values , So here now you can check phpinfo and click on save to avoid your composer error.

4 Comments

Thanks, but in my CPanel there is no page like that for checking that :(
You must have search option above search "php " you will se "select php version" there , if you dont find it , then which version of cpanel you are using?
Can not find. CPanel 82.0.16
I have 2 website on CPanel. One of them has the extension part but I can not define by interface the php version for each subdomain, so I defined it in .htaccess file. other one that I sent you the CPanel version does not have extension but I can define by interface the PHP version of each subdomain without coding. So for the first one I ask the provider to active an extension that I want and he did it.
1

enter image description here

if you type php --ini your output wil be like this if we're using using the same

 php version Loaded Configuration File: C:\Program Files\php-8.1.13-nts-Win32-vs16-x64\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) 

just go to you *php-8.1.13-nts-Win32-vs16-x64* you will see php without extension format open it with your editor and uncomment extension=fileinfo

Comments

1

Notice! If you are using WSL Alpine Linux

When prompted with any error just search and install it it will be set automatically.

For example;

sudo apk search zip 

You will see like for my case (php82-zip-8.2.10-r0) but anything before number is what we will add to apk.

sudo apk add php82-zip 

Hope it helps!

Comments

0

I don't know if this will help, but it worked for me:

The problem seems to be with the php extensions. So, I tried using xampp instead of php alone (throughout the installation of xampp there is an option to add php). Then installed the composer with the php path of xampp.

Let me know if this works for you too!

P.S. This helped me with other errors too.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.