寫在最前面的話:
最近有個(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