欢迎访问www.showerlee.com, 您的支持就是我前进的动力.

PHP添加mcrypt扩展模块

showerlee 2013-08-27 18:47 PHP 阅读 (15,671) 抢沙发

系统环境:centOS6.3

APACHE:httpd-2.4.2

PHP:php-5.3.21

一.安装mcrypt

1.下载Libmcrypt,mhash,mcrypt安装包 

libmcrypt-2.5.8.tar.gz

# wget http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459

mhash-0.9.9.tar.gz

# wget http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300&release_id=645636

mcrypt-2.6.8.tar.gz

# wget http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91948&release_id=642101 

2 .先安装Libmcrypt

# tar -zxvf libmcrypt-2.5.8.tar.gz

# cd libmcrypt-2.5.8

# /usr/local/php5/bin/phpize #动态编译php模块,使其可以使用configure编译。

# ./configure

# make

# make install     # libmcript默认安装在/usr/local #

3.安装mhash

# tar -zxvf mhash-0.9.9.9.tar.gz

# cd mhash-0.9.9.9

# /usr/local/php5/bin/phpize 

# ./configure

# make

# make install

4.安装mcrypt

# tar -zxvf mcrypt-2.6.8.tar.gz

# cd mcrypt-2.6.8

# /usr/local/php5/bin/phpize 

# ./configure --with-php-config=/usr/local/php5/bin/php-config 

# make

# make install

安装完毕,按照编译安装后的提示

mcrypt.so模块会默认保存在 /usr/local/php5/lib/php/extensions/no-debug-zts-20090626/ 目录下

5.加载该模块到php

# vi /usr/local/php5/lib/php.ini

添加如下行:

extension = "/usr/local/php5/lib/php/extensions/no-debug-zts-20090626/mcrypt.so"

重启apache:

/usr/local/apache2/bin/apachectl restart

 

 

6.添加phpinfo功能,测试页面

添加以下内容info.php到/usr/local/apache2/htdocs/下,测试php模块是否加载.

# vi  /usr/local/apache2/htdocs/info.php

---------------

<?php

echo phpinfo();

?>

---------------

检查80端口是否打开

# lsof -i:80

浏览器输入 http://localhost/info.php

显示有如下测试页面内容, mcrypt.so模块即在PHP下加载成功

2

正文部分到此结束
版权声明:除非注明,本文由(showerlee)原创,转载请保留文章出处!
本文链接:http://www.showerlee.com/archives/583

继续浏览:McryptPHP

还没有评论,快来抢沙发!

发表评论

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif