phpmyadmin提示缺少mcrypt扩展
环境配置:阿里云服务器ECS,操作系统CentOS 8.3 64位,PHP版本7.3.20
操作如下:
#第一步
#下载Libmcrypt,mhash,mcrypt安装包,下载地址http://www.sourceforge.net
wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz
#第二步
#相继解压安装
###安装libmcrypt
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
###安装mhash
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make install
###安装mcrypt
###注意,mcrypt 扩展从 php 7.1.0 开始废弃;自 php 7.2.0 起,会移到 pecl
wget http://pecl.php.net/get/mcrypt-1.0.1.tgz
tar -zxvf mcrypt-1.0.1.tgz
cd mcrypt-1.0.1
###确认phpize位置
whereis phpize
phpize: /usr/bin/phpize /usr/share/man/man1/phpize.1.gz
###在使用php的过程中,我们常常需要去添加一些PHP扩展库。但是重新对php进行编译是比较蛮烦的,所以这时候我们可以使用phpize对php进行添加扩展。并且phpize编译的扩展库可以随时启用或停用,比较灵活。
###运行php安装目录下的phpize文件,这时候会在mcrypt-1.0.1目录下生成相应的configure文件。
/usr/bin/phpize
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
###编译准备
./configure --with-php-config=/usr/bin/php-config
###安装
make && make install
#第三步
#在php.ini加上扩展
extension = mcrypt.so
#第四步
#重启php
service php-fpm restart
#如果安装成功,可以通过phpinfo查看mcrypt模块已被安装