laravel5.6使用扩展包image时报错Your requirements could not be resolved to an installable set of packages.

写在最前面的话:

最近有个项目需求:二维码是动态,可随时变更链接,然后又要把二维码放在指定的大图的某个地方(中间,左上方……),这种需求对于UI或者PS大神来说,是轻而易举的事情,但是对我来说,没办法,只有通过代码来对两张图片进行合成,但是在借助外部扩展的时候报错

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - intervention/image 2.4.x-dev requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - intervention/image 2.4.2 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - intervention/image 2.4.1 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - intervention/image 2.4.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - Installation request for intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].

  To enable extensions, verify that they are enabled in your .ini files:
    - D:\phpStudy\PHPTutorial\php\php-7.2.1-nts\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

解决办法:

一、Windows环境下:

在Windows环境下一般的用户都使用了集成环境(phpstudy,WampServer,XAMPP……),以phpstudy为例:phpstudy 默认没有开启 openssl 和 fileinfo 扩展;可以按下图勾选即可;

laravel5.6使用扩展包image时报错Your requirements could not be resolved to an installable set of packages._第1张图片
image.png

二、Linux环境下

1、检查当前环境:
php -i|grep fileinfo

看是否已安装fileinfo扩展,若没有,则进行下一步。

2、安装fileinfo扩展
2.1、下载扩展包 (如果有安装,则忽略相应的步骤)

根据各自的版本号进行下载

wget -O php-5.6.25.tar.gz http://cn2.php.net/get/php-5.6.25.tar.gz/from/this/mirror
2.2、解压
tar -zxvf php-5.6.25.tar.gz
2.3、进入该扩展目录
cd /alidata/server/php/php-5.6.25/ext/fileinfo

该扩展暂时解压在/alidata/server/php目录下

2.4、编译 && 安装

/alidata/server/php/bin/phpize
./configure -with-php-config=/alidata/server/php/bin/php-config
make && make install

这样,就会在系统默认的扩展目录下新生成一个fileinfo.so文件

2.5、修改php.ini文件

加入:extension=fileinfo.so

备注:如果遇到其它问题,你有更好的解决方法,又或者哪里有错误,都可以留言,我们一起探讨哦!!!,看到这了,就喜欢或者留个言吧 (* ̄︶ ̄)。

你可能感兴趣的:(laravel5.6使用扩展包image时报错Your requirements could not be resolved to an installable set of packages.)