需要安装三个软件包,分别是:
libmcrypt-2.5.8.tar.gz
mhash-0.9.9.9.tar.gz
mcrypt-2.6.8.tar.gz
1.先安装libmcrypt (说明:libmcript默认安装在/usr/local )
1. #tar -zxvf libmcrypt-2.5.8.tar.gz
2. #cd libmcrypt-2.5.8
3. #./configure
4. #make
5. #make install
6.
2.安装mhash
1. #tar -zxvf mhash-0.9.9.9.tar.gz
2. #cd mhash-0.9.9.9
3. #./configure
4. #make
5. #make install
3.安装mcrypt
1. #tar -zxvf mcrypt-2.6.8.tar.gz
2. #cd mcrypt-2.6.8
3. #export LD_LIBRARY_PATH=/usr/local/lib // 通过set命令查看环境变量
4. ./configure
5. #make
6. #make install
注意:由于在配置mcrypt时,会找不到libmcrypt的链接库,导致无法编译,因为Libmcrypt的链接库在/usr/local/文件夹下。因些在配置mcrypt时要加入LD_LIBRARY_PATH=/usr/local导入键接库。
# export LD_LIBRARY_PATH=/usr/local/lib ( 通过whereis libmcrypt查看路径然后配置)
4.安装PHP扩展模块:动态加载
使用php的常见问题是:编译php时忘记添加某扩展,后来想添加扩展,但是因为安装php后又装了一些东西如PEAR等,不想删除目录重装,于是可以采用phpize。
方法是:
1).要有与现有php完全相同的php压缩包 展开后进入里面的ext/mcrypt目录 (里面是mcrypt的php扩展)
#cd /smb/php-5.1.6/ext/mcrypt //我的机器里装的是php-5.1.6.tar.gz
2).执行/usr/local/bin/phpize,执行完后,会发现当前目录下多了一些configure文件,如果没报错,则根据提示运行。
#/usr/local/bin/phpize //可通过 whereis phpize 查看命令位置
./configure –with-php-config=/usr/bin/php-config
make && make install
再去/usr/lib64/php/modules/ 查看mcrypt.so文件生成了,配置php.ini 载入拓展即可
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/361.html