I have ext-fileinfo but Composer says it is missing

試著忘記壹切 提交于 2019-12-30 01:47:44

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答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.




回答5:


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




回答6:


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.




回答7:


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.




回答8:


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.



来源:https://stackoverflow.com/questions/24850136/i-have-ext-fileinfo-but-composer-says-it-is-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!