如果你在开发中需要使用mcrypt扩展,有时候会遇到:
Call to undefined function: mcrypt_module_open()
或其它有mcrypt的函数报错,PHP7.2已放弃对mcrypt的支持。
1. 安装libmcrypt
2. mcrypt
3. phpize
4. re2c
我安装的时候遇到这四个,如果你在编译的时候遇到其它错误那请根据你实际缺的包去安装。
wget http://pecl.php.net/get/mcrypt-1.0.1.tgz
wget https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz
上面是三个安装包。依次安装 libmcrypt, re2c
安装方法:
tar zxvf re2c-0.16.tar.gz
cd re2c-0.16
./configure
make && make install
方法都一样哦,先解压,然后进目录 ,然后./configure, 再然后 make && make install
下面安装mcrypt
解压后进入目录 mcrypt:
phpize
然后 ./configure
make && install
最后一步,找到你的php.ini 加入: extension=mcrypt
搞定!
参考:
https://blog.csdn.net/a454213722/article/details/51866100
https://blog.csdn.net/yhb598712254/article/details/80621473
http://www.zjmainstay.cn/php-mcrypt