前言
宝塔面板问题解决 – PHP安装不上fileinfo扩展?
不知道大家在使用宝塔面板的时候,为PHP安装fileinfo扩展感到非常苦恼?
我前两天为我的PHP7.4安装fileinfo扩展时,怎么安装都安装不上,然后在网上找各种此问题的解决方案,但是都没有解决我的这个问题。
最后实在找不到此问题的解决方案了,干脆靠自己吧。分析分析扩展安装时的日志看看问题到底出错在哪里。因为我的服务器是4核4G的,首先排除因内存小的原因导致安装不上。
以下是扩展安装时的日志:
Connecting to na1-node.bt.cn (na1-node.bt.cn)|128.1.164.196|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5435 (5.3K) [application/octet-stream]
Saving to: ‘fileinfo.sh’
0K ..... 100% 213M=0s
2023-07-06 11:13:40 (213 MB/s) - ‘fileinfo.sh’ saved [5435/5435]
正在选择下载节点...
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
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 for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /www/server/php/74
checking for PHP includes... -I/www/server/php/74/include/php -I/www/server/php/74/include/php/main -I/www/server/php/74/include/php/TSRM -I/www/server/php/74/include/php/Zend -I/www/server/php/74/include/php/ext -I/www/server/php/74/include/php/ext/date/lib
checking for PHP extension directory... /www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902
checking for PHP installed headers prefix... /www/server/php/74/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for fileinfo support... yes, shared
checking for strcasestr... yes
checking for utimes... yes
checking for strndup... yes
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for /bin/ld option to reload object files... -r
checking for BSD-compatible nm... /bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
/bin/sh /www/server/php/74/src/ext/fileinfo/libtool --mode=link cc -DPHP_ATOM_INC -I/www/server/php/74/src/ext/fileinfo/include -I/www/server/php/74/src/ext/fileinfo/main -I/www/server/php/74/src/ext/fileinfo -I/www/server/php/74/include/php -I/www/server/php/74/include/php/main -I/www/server/php/74/include/php/TSRM -I/www/server/php/74/include/php/Zend -I/www/server/php/74/include/php/ext -I/www/server/php/74/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o fileinfo.la -export-dynamic -avoid-version -prefer-pic -module -rpath /www/server/php/74/src/ext/fileinfo/modules fileinfo.lo libmagic/apprentice.lo libmagic/apptype.lo libmagic/ascmagic.lo libmagic/cdf.lo libmagic/cdf_time.lo libmagic/compress.lo libmagic/encoding.lo libmagic/fsmagic.lo libmagic/funcs.lo libmagic/is_json.lo libmagic/is_tar.lo libmagic/magic.lo libmagic/print.lo libmagic/readcdf.lo libmagic/softmagic.lo libmagic/der.lo libmagic/buffer.lo
libtool: link: `libmagic/buffer.lo' is not a valid libtool object
make: *** [Makefile:231: fileinfo.la] Error 1
error
|-Successify --- 命令已执行! ---
libtool: link: `libmagic/buffer.lo' is not a valid libtool object
问题解决
sudo yum install gcc libtool autoconf
cd /www/server/php/74/src/ext/fileinfo
make clean
cd /www/server/php/74/src/ext/fileinfo
/www/server/php/74/bin/phpize
./configure --with-php-config=/www/server/php/74/bin/php-config
make
Build complete.
Don't forget to run 'make test'.
make install
/www/server/php/74/etc/php.ini
)在该配置文件最后写上以下内容:
extension=fileinfo
sudo systemctl restart nginx
用户28908102 昨天0
如果我之前有过但是换手机从新弄密钥还能继续用吗?用户94592005 昨天0
到你是你说难道不是你用户98657779 前天0
我要密钥用户98657779 前天0
我要Key用户17734051 前天0
这个下载下来是一张图片用户79658107 前天0
[图片]用户79658107 前天0
一直显示验证,打不开用户79658107 前天0
[图片]