php 我有 ext-fileinfo 但 Composer 说它丢失了
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24850136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I have ext-fileinfo but Composer says it is missing
提问by Webinan
I'm trying to install Laravel package Intervention Image and when I run composer update
:
我正在尝试安装 Laravel 包干预图像,当我运行时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()
:
我有 php 5.4 并且在php.ini
和 中启用了扩展phpinfo()
:
fileinfo
fileinfo support enabled
version 1.0.5
and restarted apache... but still no luck.
并重新启动 apache ......但仍然没有运气。
回答by vivek
Windows users: just edit php.ini
and uncomment this line:
Windows 用户:只需编辑php.ini
并取消注释此行:
extension=php_fileinfo.dll
Remember to restart Apache for new php.ini to take effect.
记得重启 Apache 使新的 php.ini 生效。
回答by Webinan
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.
显然这是因为php.ini
web/apache 和 CLI有单独的文件,并且 composer 使用 CLI 而 phpinfo() 使用 mainphp.ini
出现问题。
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
如果您php -m
在 CLI 中运行并且没有看到模块的名称,您应该找到 CLI php.ini
(在我的情况下php-cli.ini
并添加扩展名。例如extension=php_fileinfo.dll
回答by user3345994
I have the same problem. Fixed now.
you can also uncomment this line
我也有同样的问题。现在固定。
你也可以取消注释这一行
extension=php_fileinfo.dll
in the following files:
在以下文件中:
php.ini-development
php.ini-production
php.ini-development
php.ini-production
Please don't forget to restart
your Apache.
Hope this will help.
请不要忘记restart
你的Apache。
希望这会有所帮助。
回答by peter.babic
Depending on your platform, there may be more php.ini, if you are using Wamp, then there are two:
根据你的平台,可能会有更多的php.ini,如果你使用的是Wamp,那么有两个:
- wamp\bin\php\php5.4.3\php.ini
- wamp\bin\apache\Apache2.4.4\bin\php.ini
- 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.
确保扩展在两者中都未注释,然后再次重新启动 apache。
回答by TomKo1
On Windows I had to add line extension=php_fileinfo.dll
in my php.ini file
在 Windows 上,我必须extension=php_fileinfo.dll
在 php.ini 文件中添加一行
回答by Charles Hasse
I have this exactly same problem. Fixed by going to wamp/bin
folder, and searching for .ini
. You will find several php.ini
files.
我有这个完全相同的问题。通过转到wamp/bin
文件夹并搜索.ini
. 你会找到几个php.ini
文件。
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.
编辑extension=php_fileinfo.dll
所有这些行中的行,删除 ; 在每个人的乞求下。重新启动 WAMP,php -m
在命令行中输入以检查 fileinfo 现在是否存在。
Should work.
应该管用。
回答by DEEPAK
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.
如果有人想知道如何在 cpanel(基于 linux)中执行此操作,只需在搜索框中搜索选择 php 版本并单击它,然后下一个屏幕您将显示当前的 php 版本,然后您会看到许多带有一些值的复选框,所以现在您可以检查 phpinfo 并单击保存以避免您的作曲家错误。
回答by tjrtmonline
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.
在 php ini 配置文件中取消注释 extension=php_fileinfo.dll(如果需要,php.ini-development)然后如果您使用 XAMPP,请使用 apache shell。它可以从 XAMPP 控制面板加载,运行 php -m 以验证扩展是否已加载。然后运行作曲家安装。