首先下载,并安装
libmcrypt-2.5.8.tar.gz
下载地址: http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459
mhash-0.9.9.tar.gz
下载地址: http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300&release_id=645636
mcrypt-2.6.8.tar.gz
下载地址: http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91948&release_id=642101
安装流程是一样的,解压后,进入解压包
./configure
(安装mcrypt时进行此项可能会出现:configure:error: *** libmcrypt was not found,这是因为环境变量的问题,gcc编译的时候根据自身定义的变量寻找相关函数库等文件,
libmcrypt也是刚安装的,在变量中没有定义出来,所以手动添加:export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH,再次编译即可)
make && make install
然后开始安装PHP扩展
进入PHP安装包下的ext文件夹,找到mcrypt
cd /home/local/php-5.6.25/ext/mcrypt
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
cp /usr/local/php/lib/php/extensions/no-debug-zts-20131226/mcrypt.so /usr/local/php/extension/mcrypt.so
php.ini添加,extension = mcrypt.so
/usr/local/apache/bin/apachectl restart