[phpMyAdmin]安装失败提示mcrypt库无法支持问题的解决方案

      今天老季提起在题库服务器上安装phpMyAdmin来管理数据库,我直接上传了phpMyAdmin-3.1.2-all-languages.tar.gz ,然后解压到/var/www/html的目录下,然后通过浏览器去安装和使用,发现提示说

无法载入 mcrypt 扩展,<br />请检查 PHP 配置

使用 yum install php-mcrypt 安装mcrypt扩展时会提示没有安装包

Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do

mcrypt 是加密扩展库,加载了它可以用他里面自带的22种加密解密算法

CentOS6 默认安装的是php5.3.2 ,而默认的 redhat repos php中是没有 mcrypt 扩展的
根据红帽的官方消息(https://bugzilla.redhat.com/show_bug.cgi?id=621268)RHEL 不打算添加PHP的mcrypt 的支持

Joe Orton 2010-08-05 04:47:17 EDT

Thanks for the report.

We are not planning to ship mcrypt support for PHP.

安装到一半,发现php-mcrypt没有相关库,查询了百度和谷歌,说是今后不再出php-mcrypt的模块了。这让我很纠结。那只好找个别的途径来实现了,源码编译安装。

从php 官网下载新的php 5.3 源码包后,解压到本地目录
进入解压目录下的 ext 目录后会发现有 mcrypt ,
进入mcrypt 目录

#cd /ext/mcrypt

#phpize

注意:如果报 -bash:phpize not Found  那么 yum install php-devel 就可以使phpize进行动态编译安装扩展

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

到了这里出现两个问题:

1.     是没有安装cc跟gcc,所以不能安装,CentOS连着网,没有问题,直接用如下命令实现安装:

#yum -y install  gcc cpp  gcc-c++  ncurses ncurses-devel gd-devel php-gd zlib-devel  freetype-devel  freetype-demos  freetype-utils libpng-devel libpng10 libpng10-devel  libjpeg-devel  ImageMagick flex  ImageMagick-devel 

# gcc -v 能看到gcc版本信息就ok了。

然后进入源码解压的目录,进行编译安装:

进入到/root/libmcrypt-2.7.1目录下

#./configure  && make && make install

手动修改php配置文件:

#vi /etc/php.ini

添加如下的内容:extension=/usr/local/lib/libmcrypt.so
 最后重启apache服务器:#service httpd  restart

About 李 伟斌

Just K.I.S.S To Be Or Not To Be, It's Your Qustion. --Keep It Simple & Stupid.
This entry was posted in Linux and tagged , , , , , , , , , . Bookmark the permalink.

发表评论