温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

LNMP环境下php拓展mcrypt和openssl模块

发布时间:2020-07-20 19:49:11 来源:网络 阅读:3301 作者:90后_IT女 栏目:web开发

一.编译安装mcrypt

1.先安装libmcrypt

#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install

 

2.安装mhash

#tar -zxvf mhash-0.9.9.9.tar.gz

#cd mhash-0.9.9.9

#./configure

#make

#make install

 

3.安装mcrypt

#tar -zxvf mcrypt-2.6.8.tar.gz

#cd mcrypt-2.6.8

#LD_LIBRARY_PATH=/usr/local/lib ./configure

#make

#make install

#cd /usr/local/src/php-5.3.16/ext/mcrypt/

#/usr/local/php5/bin/phpize
#./configure --with-php-config=/usr/local/php5/bin/php-config
#make
#make install
#echo"extension=mcrypt.so">>/etc/php.ini 
#cd/etc/php.d/ 
#echo'extension=mcrypt.so'> mcrypt.ini 
二.编译安装openssl

切换到php安装目录的etx/openssl目录
#cd /usr/local/src/php-5.3.16/ext/openssl
openssl目录下有个config.w32和config0.m4,把config0.m4改名为config.m4(原因不解释)
#mv config0.m4 config.m4
#/usr/local/bin/phpize(或$PHP_PREFIX/bin/phpize)
#./configure --with-openssl --with-php-config=/usr/local/php5/bin/php-config
#make
#make test
#make install

在php.ini内加入以下内容:
extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/"
extension = "openssl.so"

 

重启php、nginx后生效

#ps aux | grep php

#killall php-fpm

#/usr/local/php5/sbin/php-fpm &

#/etc/init.d/nginx restart

 

#/usr/local/php5/bin/php -i |grep openssl(查看openssl)

访问phpinfo页面即可显示出已加载mcrypt和openssl模块

 


配置过程中遇到的问题:

1.安装好模块后phpinfo无显示,经查看,phpinfo显示的php版本可服务器上php -v显示的不一样,安装了两个版本导致的 。

解决方法:cp /etc/php.ini /usr/local/php5/etc/php.ini,然后重启nginx和php-fpm

2.安装好openssl模块后phpinfo显示disabled

解决方法:把服务器上所有的php.ini都加以修改,并重启nginx和php-fpm

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI