首页 > php7 fileinfo 扩展如何开启

php7 fileinfo 扩展如何开启

php7编译时没有开启fileinfo扩展。请问如何不重新编译开启phpinfo。
1尝试pecl安装:
pecl install fileinfo

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 directory
of the module

ERROR: `phpize' failed

2尝试手动编译

wget https://pecl.php.net/get/File... tar zxvf
Fileinfo-1.0.1.tgz ./configure
--with-php-config=/usr/local/php/bin/php-config make && make install

但是在make的时候出错了

/bin/sh /home/download/Fileinfo-1.0.4/libtool --mode=compile cc -I.
-I/home/download/Fileinfo-1.0.4 -DPHP_ATOM_INC -I/home/download/Fileinfo-1.0.4/include -I/home/download/Fileinfo-1.0.4/main -I/home/download/Fileinfo-1.0.4 -I/usr/local/php/include/php -I/usr/local/php/include/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 -DHAVE_CONFIG_H -g -O2 -c /home/download/Fileinfo-1.0.4/fileinfo.c -o fileinfo.lo cc -I. -I/home/download/Fileinfo-1.0.4 -DPHP_ATOM_INC -I/home/download/Fileinfo-1.0.4/include -I/home/download/Fileinfo-1.0.4/main -I/home/download/Fileinfo-1.0.4 -I/usr/local/php/include/php -I/usr/local/php/include/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 -DHAVE_CONFIG_H -g -O2 -c /home/download/Fileinfo-1.0.4/fileinfo.c -fPIC -DPIC -o
.libs/fileinfo.o /home/download/Fileinfo-1.0.4/fileinfo.c:159: error:
expected ‘)’ before ‘*’ token
/home/download/Fileinfo-1.0.4/fileinfo.c:171: error: expected ‘=’,
‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fileinfo_functions’
/home/download/Fileinfo-1.0.4/fileinfo.c: In function
‘zm_startup_finfo’: /home/download/Fileinfo-1.0.4/fileinfo.c:195:
error: ‘finfo_resource_destructor’ undeclared (first use in this
function) /home/download/Fileinfo-1.0.4/fileinfo.c:195: error: (Each
undeclared identifier is reported only once
/home/download/Fileinfo-1.0.4/fileinfo.c:195: error: for each function
it appears in.) /home/download/Fileinfo-1.0.4/fileinfo.c: At top
level: /home/download/Fileinfo-1.0.4/fileinfo.c:221: error:
‘fileinfo_functions’ undeclared here (not in a function)
/home/download/Fileinfo-1.0.4/fileinfo.c: In function
‘zif_finfo_open’: /home/download/Fileinfo-1.0.4/fileinfo.c:269: error:
‘struct _php_core_globals’ has no member named ‘safe_mode’
/home/download/Fileinfo-1.0.4/fileinfo.c:269: error:
‘CHECKUID_CHECK_FILE_AND_DIR’ undeclared (first use in this function)
/home/download/Fileinfo-1.0.4/fileinfo.c: In function
‘zif_finfo_close’: /home/download/Fileinfo-1.0.4/fileinfo.c:310:
error: expected expression before ‘struct’
/home/download/Fileinfo-1.0.4/fileinfo.c:312: warning: passing
argument 1 of ‘zend_list_delete’ makes pointer from integer without a
cast /usr/local/php/include/php/Zend/zend_list.h:59: note: expected
‘struct zend_resource *’ but argument is of type ‘int’
/home/download/Fileinfo-1.0.4/fileinfo.c: In function
‘zif_finfo_set_flags’: /home/download/Fileinfo-1.0.4/fileinfo.c:336:
error: expected expression before ‘struct’
/home/download/Fileinfo-1.0.4/fileinfo.c: In function
‘_php_finfo_get_type’: /home/download/Fileinfo-1.0.4/fileinfo.c:364:
error: expected expression before ‘struct’
/home/download/Fileinfo-1.0.4/fileinfo.c:375: warning: passing
argument 2 of ‘php_stream_locate_url_wrapper’ from incompatible
pointer type /usr/local/php/include/php/main/php_streams.h:565: note:
expected ‘const char ’ but argument is of type ‘char
/home/download/Fileinfo-1.0.4/fileinfo.c:382: error:
‘ENFORCE_SAFE_MODE’ undeclared (first use in this function)
/home/download/Fileinfo-1.0.4/fileinfo.c:387:64: error: macro
"php_stream_copy_to_mem" passed 4 arguments, but takes just 3
/home/download/Fileinfo-1.0.4/fileinfo.c:387: error:
‘php_stream_copy_to_mem’ undeclared (first use in this function)
/home/download/Fileinfo-1.0.4/fileinfo.c:421:27: error: macro
"RETURN_STRING" passed 2 arguments, but takes just 1
/home/download/Fileinfo-1.0.4/fileinfo.c:421: error: ‘RETURN_STRING’
undeclared (first use in this function) make: * [fileinfo.lo] Error
1

HELP


用这种方式安装:

不需要去下载扩展,只需要进入此fileinfo目录(我这里有多个版本5.6,7版本)
比如进入5.6版本目录cd /usr/local/src/lnmp1.2-full/src/php-5.6.9/ext/fileinfo

/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
/usr/local/php/etc/php.ini 添加扩展:
extension=fileinfo.so

【热门文章】
【热门文章】