composer 遇到Install or enable PHP’s fileinfo extension. 后的一系列操作

在composer install的时候遇到了错误提示:

No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
– intervention/image[dev-master, 2.4.0, …, 2.5.1] require ext-fileinfo * -> it is missing from your system. Install or enable PHP’s fileinfo extension.
– intervention/image 2.4.x-dev is an alias of intervention/image dev-master and thus requires it to be installed too.
– Root composer.json requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, …, 2.5.1].

To enable extensions, verify that they are enabled in your .ini files:
– /www/server/php/72/etc/php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

得知 fileinfo extension 没有安装。

进入到php7的目录,php/ext/fileinfo

执行命令:

phpize

结果又遇到了问题,提示:

perl: warning: Falling back to the standard locale (“C”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
[root@iZm5e2pzwyzvxwgtxhbyw7Z fileinfo]# yum install c
Failed to set locale, defaulting to C

解决办法:

[root@iZm5e2pzwyzvxwgtxhbyw7Z fileinfo]# export LANGUAGE=”en_US.UTF-8″
[root@iZm5e2pzwyzvxwgtxhbyw7Z fileinfo]# export LANG=en_US:zh_CN.UTF-8
[root@iZm5e2pzwyzvxwgtxhbyw7Z fileinfo]# export LC_ALL=C

phpize执行成功

接着执行

/configure –with-php-config=/www/server/php/72/bin/php-config

make && make install

安装成功,提示如下:

Installing shared extensions: /www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/

扩展fileinfo,操作如下:

vim /www/server/php/72/etc/php.ini

增加一行:

extension=fileinfo.so

重新composer install 操作成功。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注