鍍金池/ 問答/PHP  Linux  HTML/ centos php7 安裝 fileinfo 失敗

centos php7 安裝 fileinfo 失敗

centos7 使用 lnmp.org 安裝的環(huán)境 安裝SmartWiki composer install 提示缺少擴展

參考 https://www.htcp.net/3675.html 也失敗了

使用pecl 安裝

[root@VM_0_14_centos Fileinfo-1.0.4]# pecl install fileinfo
WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/filein
fo/in php sources"
WARNING: channel "pear.php.net" has updated its protocols, use "pecl channel-upd
ate pear.php.net" to update
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
3 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/local/php/bin/phpize' in the top level source direc
tory of the module

ERROR: `phpize' failed
[root@VM_0_14_centos Fileinfo-1.0.4]#cd /tmp/pear/download/Fileinfo-1.0.4
[root@VM_0_14_centos Fileinfo-1.0.4]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
[root@VM_0_14_centos Fileinfo-1.0.4]# ./configure --with-php-config=/usr/local/
php/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/inclu
de/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend
-I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-deb
ug-non-zts-20160303
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate
 PHP parsers.
checking for gawk... gawk
checking for fileinfo support... yes, shared
checking for magic files in default path... not found
configure: error: Please reinstall the libmagic distribution

參考You will need re2c 0.13.4 or later

wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz
tar zxf re2c-0.16.tar.gz && cd re2c-0.16
./configure
make && make install

[root@VM_0_14_centos Fileinfo-1.0.4]# ./configure --with-php-config=/usr/local/
php/bin/php-config       20160303
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... ccFileinfo-1.0.4]#
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/inclu
de/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend
-I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-deb
ug-non-zts-20160303
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking for fileinfo support... yes, shared
checking for magic files in default path... not found
configure: error: Please reinstall the libmagic distribution

最后 Please reinstall the libmagic distribution 這個錯誤不知道怎么解決

回答
編輯回答
逗婦乳

http://php.net/manual/zh/ref....

yum install file-devel

2017年12月24日 20:12
編輯回答
貓館
2017年11月7日 04:33
編輯回答
萢萢糖

安裝下 file-devel 就可以了
http://php.net/manual/zh/ref....

2017年10月12日 01:17