centos安装php缺失fileinfo.so扩展解决

本文介绍如何检查系统是否已安装PHP fileinfo扩展,并提供详细的步骤指导如何下载、编译及安装该扩展。此外还介绍了如何配置php.ini启用扩展并重启服务器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.首先检查系统是否已经安装

[root@iZbp1dwql3ymcem09rfdchZ ~]# php -i|grep fileinfo
Configure Command =>  './configure'  '--prefix=/alidata/server/php' '--enable-opcache' '--with-config-file-path=/alidata/server/php/etc' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-fpm' '--enable-fastcgi' '--enable-static' '--enable-inline-optimization' '--enable-sockets' '--enable-wddx' '--enable-zip' '--enable-calendar' '--enable-bcmath' '--enable-soap' '--with-zlib' '--with-iconv' '--with-gd' '--with-xmlrpc' '--enable-mbstring' '--without-sqlite' '--with-curl' '--enable-ftp' '--with-mcrypt' '--with-freetype-dir=/usr/local/freetype.2.1.10' '--with-jpeg-dir=/usr/local/jpeg.6' '--with-png-dir=/usr/local/libpng.1.2.50' '--disable-ipv6' '--disable-debug' '--with-openssl' '--disable-maintainer-zts' '--disable-safe-mode' '--disable-fileinfo'
fileinfo
fileinfo support => enabled

如果出现上面说明已经安装


2.执行下载包含fileinfo扩展的php安装包命令,也可以独立下载fileinfo编译安装包

wget -O php-5.6.9.tar.gz http://cn2.php.net/get/php-5.6.9.tar.gz/from/this/mirror


3.解压

tar -zxvf php-5.6.9.tar.gz


4.当前目录解压完,进入下面目录 

cd php-5.6.9/ext/fileinfo/


5.在之前已经编译安装的的php的bin目录中找到命令phpize执行生成.configure文件

本人已安装php的目录命令:/alidata/server/php-5.5.7/bin/phpize

6.配置、编译安装

 ./configure -with-php-config=/alidata/server/php-5.5.7/bin/php-config

make && make install


7.修改php.ini
加入:extension=fileinfo.so

8.重启服务器,完成


# LAMP Auto Install Script for CentOS 7 #centos7下编写自动化脚本搭建lamp架构,下载目录为/opt/lamp1/,需求版本:apache-2.4.63、php-7.4.33、mysql-8.0.41-1.el9.x86_64.rpm-bundle.tar,php不用单独启动,和apache联动即可 #要求: #安装apache和php的依赖模块apr-1.7.5、apr-util-1.6.3、ibiconv-1.15、libmcrypt-2.5.8、mhash-0.9.9.9、mcrypt-2.6.8、libmcrypt-devel并做好环境变量和软连接 #apache开启模块如下模块并解决依赖问题(core_module, authn_file_module, authn_default_module, authz_host_module, authz_groupfile_module, authz_user_module, authz_default_module, auth_basic_module, include_module, filter_module, log_config_module, env_module, setenvif_module, version_module, mpm_prefork_module, http_module, mime_module, status_module, autoindex_module, asis_module, cgi_module, negotiation_module, dir_module, actions_module, userdir_module, alias_module, rewrite_module, so_module, ssl_module (shared), xsendfile_module (shared), php7_module (shared)) #php开启模块如下模块并解决依赖问题(bcmath,bz2,Core,ctype,curl,date,dom,ereg,fileinfo,filter,gd,gettext,hash,iconv,json,libxml,mbstring,mcrypt,mhash,mysql,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_sqlite,Phar,posix,Reflection,session,shmop,SimpleXML,soap,sockets,SPL,sqlite3,standard,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,zip,zlib) #保留以上模块并解决依赖关系,此外apache、php的模块全部启用并加载 #验证apache和php联动访问,MySQL登录和初始化、密码设置为1hblsqt2zhlmcl#@!
03-11
# LAMP Auto Install Script for CentOS 7 #centos7下搭建lamp架构,需求版本:apache-2.4.63、php-7.4.33、mysql-8.0.41-1.el9.x86_64.rpm-bundle.tar,php不用单独启动,和apache联动即可 #要求: #目前线上apache使用的模块为(core_module, authn_file_module, authn_default_module, authz_host_module, authz_groupfile_module, authz_user_module, authz_default_module, auth_basic_module, include_module, filter_module, log_config_module, env_module, setenvif_module, version_module, mpm_prefork_module, http_module, mime_module, status_module, autoindex_module, asis_module, cgi_module, negotiation_module, dir_module, actions_module, userdir_module, alias_module, rewrite_module, so_module, ssl_module (shared), xsendfile_module (shared), php5_module (shared)) #目前线上php使用的模块为(bcmath,bz2,Core,ctype,curl,date,dom,ereg,fileinfo,filter,gd,gettext,hash,iconv,json,libxml,mbstring,mcrypt,mhash,mysql,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_sqlite,Phar,posix,Reflection,session,shmop,SimpleXML,soap,sockets,SPL,sqlite3,standard,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,zip,zlib) #安装apache和php的依赖模块apr-1.7.5、apr-util-1.6.3、ibiconv-1.15、libmcrypt-2.5.8、mhash-0.9.9.9、mcrypt-2.6.8、libmcrypt-devel并做好环境变量和相应的软连接 #保留以上模块前提下,apache、php的模块全部启用 #下载目录为/opt/install/,使用源码安装搭建,依赖等问题并编写自动化脚本 #验证apache和php联动性、访问,MySQL登录和初始化、密码设置为1hblsqt2zhlmcl#@!
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值