逐梦论坛's Archiver

shillan 发表于 2016-11-11 08:30

php5.3 安装mcrypt的方法

For me the answer was:

1) Get the Repos from

[color=#ff0000]wget [url=http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm]http://dl.fedoraproject.org/pub/ ... ease-6-8.noarch.rpm[/url]
wget [url=http://rpms.famillecollet.com/enterprise/remi-release-6.rpm]http://rpms.famillecollet.com/enterprise/remi-release-6.rpm[/url]
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm[/color]
2) Install it via:

sudo yum update
[color=#ff0000]sudo yum install php-mcrypt*
3) Edit the mcrypt.ini

sudo nano /etc/php.d/mcrypt.ini
add this

extension=/usr/lib64/php/modules/mcrypt.so
Finally
4) Restart your webserver:[/color]

sudo service httpd restart
I run this steps in CentOS 6.3 (64) on Azure From Microsoft Linux image

Hope it helps you.

Best Regards.

shillan 发表于 2016-11-11 08:31

PHP5.3.3添加安装mcrypt模块

yum -y install httpd php53 php53-bcmath php53-cli php53-common php53-dba php53-devel php53-gd php53-imap php53-intl php53-ldap php53-mbstring
php53-mysql php53-odbc64 php53-pdo php53-pgsql php53-process php53-pspell php53-snmp php53-soap php53-xml php53-xmlrpc php-pear


wget [url]http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&ts=1430725959&use_mirror=ncu[/url]

wget [url]http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F&ts=1430726021&use_mirror=ncu[/url]

wget [url]http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F&ts=1430726218&use_mirror=ncu[/url]
wget [url]http://museum.php.net/php5/php-5.3.3.tar.gz[/url]



yum -y install gcc gcc-c++ make
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
cd ..

tar zxf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make install
cd ..

tar zxf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/lib ./configure
make
make install
cd ..

tar zxf php-5.3.3.tar.gz
cd php-5.3.3/ext/mcrypt/
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
make
make install

echo 'extension=mcrypt.so' > /etc/php.d/mcrypt.ini
/etc/init.d/httpd reload
php -m |grep 'mcrypt'

shillan 发表于 2016-11-11 08:32

让CentOS下PHP5.3+支持mcrypt

居说红帽子将不再对mcrypt提供支持,导致一些国外的开源PHP项目无法正常工作。其实解决的方法依然很简单。步骤如下:
下载同版本PHP的源代码
解压PHP源代码后,进入 ext/mcrypt目录
自己手工编译 mcrypt 源代码,生成 mcrypt.so
修改 /etc/php.ini 文件,添加 mcrypt.so
编mcrypt步骤:
进入mcrypt目录,执行以下操作
phpize
./configure --with-php-config=/usr/bin/php-config
make
make install
如果在编译过程中发生错误,如: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

编译成功后,会在 /usr/lib/php/modules 目录下生成 mcrypt.so 文件
修改/etc/下的 php.ini文件,添加:extension=mcrypt.so
然后重新启动web服务程序,你的php5.3+将完成对mcrypt的支持设置

shillan 发表于 2016-11-11 08:35

Linux下PHP安装mcrypt扩展模块笔记

系统环境:centOS6.3
APACHE:httpd-2.4.2
PHP:php-5.3.21
一.安装mcrypt
1.下载Libmcrypt,mhash,mcrypt安装包[code]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[/code]2 .先安装Libmcrypt[code]# 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[/code]3.安装mhash[code]# tar -zxvf mhash-0.9.9.9.tar.gz
# cd mhash-0.9.9.9
# /usr/local/php5/bin/phpize
# ./configure
# make
# make install[/code]4.安装mcrypt[code]# 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[/code]安装完毕,按照编译安装后的提示
mcrypt.so模块会默认保存在 /usr/local/php5/lib/php/extensions/no-debug-zts-20090626/ 目录下
5.加载该模块到php[code]# vi /usr/local/php5/lib/php.ini[/code]添加如下行:[code]extension = "/usr/local/php5/lib/php/extensions/no-debug-zts-20090626/mcrypt.so"[/code]重启apache:[code]/usr/local/apache2/bin/apachectl restart[/code]6.添加phpinfo功能,测试页面
添加以下内容info.php到/usr/local/apache2/htdocs/下,测试php模块是否加载.[code]# vi  /usr/local/apache2/htdocs/info.php[/code][code]---------------
<?php
echo phpinfo();
?>
---------------[/code]检查80端口是否打开[code]# lsof -i:80[/code]浏览器输入 http://localhost/info.php
显示有如下测试页面内容, mcrypt.so模块即在PHP下加载成功

bcmvy 发表于 2016-12-1 10:23

好帖,有才!

bcmvy 发表于 2016-12-5 17:34

这么强,支持楼主,佩服

淡然一切琐碎 发表于 2017-3-27 07:01

看看吧,大家都会支持你

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.