要安装Linux的mcrypt扩展,需要以下几个软件:
1. Libmcrypt-2.5.8
下载地址:http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
2.mhash-0.9.9.9
下载地址:http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
3.mcrypt-2.6.8
下载地址:http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
4.php-5.3.24 源码包
下载地址:http://cn2.php.net/distributions/php-5.3.24.tar.gz
首先安装1-3三个软件包,安装方法是:
# tar -xvf libmcrypt-X.X.X.tar # cd libmcrypt-X.X.X # ./configure # make # make install
sed -i 's|PHP_FE_END|{NULL,NULL,NULL}|' ./ext/**/*.c sed -i 's|ZEND_MOD_END|{NULL,NULL,NULL}|' ./ext/**/*.c
其它解压 php源码,运行前如果没有安装 php-devel 的话,需要通过 yum 安装相应版本的 php-devel 就可以。
进行解压后的php源码目录,里面有 ext/mcrypt
# cd ext/mcrypt # phpize # aclocal # ./configure # make clean # make # make install
备注:
如果在安装libmcrypt等软件时提示:
checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no
那么,请通过yum install gcc 安装相应开发包。
如果报:error: ‘PHP_FE_END’ undeclared here (not in a function) 类似这样的错误
可执行下面的代码来解决:
sed -i 's|PHP_FE_END|{NULL,NULL,NULL}|' ./ext/**/*.c sed -i 's|ZEND_MOD_END|{NULL,NULL,NULL}|' ./ext/**/*.c
如果你看到下面的提示就说明你安装成功了:
[root@a mcrypt]# make install Installing shared extensions: /usr/lib64/php/modules/