laravel5.6使用擴(kuò)展包image時(shí)報(bào)錯(cuò)Your requirements could not be resolved to an installable set of packages.

寫在最前面的話:

最近有個(gè)項(xiàng)目需求:二維碼是動(dòng)態(tài),可隨時(shí)變更鏈接,然后又要把二維碼放在指定的大圖的某個(gè)地方(中間,左上方……),這種需求對于UI或者PS大神來說,是輕而易舉的事情,但是對我來說,沒辦法,只有通過代碼來對兩張圖片進(jìn)行合成,但是在借助外部擴(kuò)展的時(shí)候報(bào)錯(cuò)

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環(huán)境下:

在Windows環(huán)境下一般的用戶都使用了集成環(huán)境(phpstudy,WampServer,XAMPP……),以phpstudy為例:phpstudy 默認(rèn)沒有開啟 openssl 和 fileinfo 擴(kuò)展;可以按下圖勾選即可;

image.png

二、Linux環(huán)境下

1、檢查當(dāng)前環(huán)境:
php -i|grep fileinfo

看是否已安裝fileinfo擴(kuò)展,若沒有,則進(jìn)行下一步。

2、安裝fileinfo擴(kuò)展
2.1、下載擴(kuò)展包 (如果有安裝,則忽略相應(yīng)的步驟)

根據(jù)各自的版本號進(jìn)行下載

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、進(jìn)入該擴(kuò)展目錄
cd /alidata/server/php/php-5.6.25/ext/fileinfo

該擴(kuò)展暫時(shí)解壓在/alidata/server/php目錄下

2.4、編譯 && 安裝

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

這樣,就會(huì)在系統(tǒng)默認(rèn)的擴(kuò)展目錄下新生成一個(gè)fileinfo.so文件

2.5、修改php.ini文件

加入:extension=fileinfo.so

備注:如果遇到其它問題,你有更好的解決方法,又或者哪里有錯(cuò)誤,都可以留言,我們一起探討哦!!!,看到這了,就喜歡或者留個(gè)言吧 (* ̄︶ ̄)。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容