步骤:
1.从php.net上面下载php5.3.x版本的源码;
2.centos安装相应的扩展包:
yum install libmcrypt libmcrypt-devel mcrypt mhash
下面的开发环境是为了编译整个php源码准备的环境,此次编译mcrypt扩展不需要执行.
yum install -y httpd-devel libtool-ltdl libtool-ltdl-devel openssl-devel curl-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
libc-client libc-client-devel gd gd-devel libmcrypt libmcrypt-devel \
sqlite sqlite-devel mysql-devel libicu libicu-devel pcre-devel
3.确定phpize有安装到服务器:
whereis phpize
确定php-config的位置:
whereis php-config
执行:
./configure –with-php-config=/usr/bin/php-config
4.make错误:
mcrypt.c:283: error: ‘PHP_FE_END' undeclared here (not in a function)
解决方法:
sed -i 's|PHP_FE_END|{NULL,NULL,NULL}|' ./ext/**/*.c
make
如果是ZEND_MOD_END的错误,则执行:
sed -i 's|ZEND_MOD_END|{NULL,NULL,NULL}|' ./ext/**/*.c
5.执行下 make test,测试没有问题.再执行:
make install
6.增加文件: /etc/php.d/mcrypt.ini
; Enable mbstring extension module
extension=mcrypt.so
7.重启web服务器,检查php mcrypt是否安装成功.