如果你在開發中需要使用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