An Error Was Encountered
The Encrypt library requires the Mcrypt extension.
CI 框架 缺少 mcrypt 扩展
yum 安装 mcrypt
yum install libmcrypt libmcrypt-devel mcrypt mhash
源码编译没试,可参考这篇文章
安装 php 的 mcrypt 扩展
扩展在 php 安装包的 ext 目录下
[root@instance-jewlel2q ~]# cd php-5.6.30/
[root@instance-jewlel2q php-5.6.30]# cd ext/mcrypt/
[root@instance-jewlel2q mcrypt]# /usr/local/php5/bin/phpize
返回
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@instance-jewlel2q mcrypt]# ./configure --with-php-config=/usr/local/php5/bin/php-config
返回
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
编译
[root@instance-jewlel2q mcrypt]# make
[root@instance-jewlel2q mcrypt]# make install
Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/
查看扩展目录
[root@instance-jewlel2q mcrypt]# cd /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/
[root@instance-jewlel2q no-debug-non-zts-20131226]# ll
total 2092
-rwxr-xr-x 1 root root 170080 Nov 1 17:02 mcrypt.so
-rwxr-xr-x 1 root root 1340288 Nov 1 14:59 opcache.a
-rwxr-xr-x 1 root root 623648 Nov 1 14:59 opcache.so
安装成功
向 php.ini 写入扩展目录
vim /usr/local/php5/lib/php.ini
重启,查看 phpinfo
采坑记录
php 的配置文件应放在 lib 目录下,自己在 ext 目录下一直不生效,换到 lib 目录下重载后生效了