温馨提示:本文最后更新于
2025-06-05 09:47:35
,某些文章具有时效性,若有错误或已失效,请在下方留言。在 Centos 7
中安装 php 8.2
的 fileInfo
扩展,宝塔面板安装的过程中会出现错误
![图片[1]-php 8.2 安装fileInfo扩展-Stewed Noodles 资源](https://img.stewednoodles.com/images/2025/06/05/StewedNoodles20250605092710.webp)
解决方法如下
# 打开目录
cd /www/server/php/82/src/ext/fileinfo/
# 生成编译配置文件,并准备编译环境
/www/server/php/82/bin/phpize
# 配置编译环境
./configure --with-php-config=/www/server/php/82/bin/php-config
# 将Makefile文件中的 CFLAGS = -g -O2 修改为 CFLAGS = -std=c99 -g
# 也可以使用vim命令,打开文件进行修改
sed -i "s#CFLAGS = -g -O2#CFLAGS = -std=c99 -g#g" Makefile
# 编译并安装
make && make install
# 将fileinfo扩展写入PHP解析器的配置文件
echo "extension=/www/server/php/82/lib/php/extensions/no-debug-non-zts-20220829/fileinfo.so" >> /www/server/php/82/etc/php.ini
# 将fileinfo扩展写入PHP命令行解析器的配置文件
echo "extension=/www/server/php/82/lib/php/extensions/no-debug-non-zts-20220829/fileinfo.so" >> /www/server/php/82/etc/php-cli.ini
# 重启php
/etc/init.d/php-fpm-82 restart
© 版权声明
THE END
暂无评论内容