`
phpseyo
  • 浏览: 158510 次
  • 性别: Icon_minigender_1
  • 来自: 广西
社区版块
存档分类
最新评论

linux安装 MCrypt 模块

阅读更多

What is MCrypt?

MCrypt is a replacement for the old crypt() package and crypt(1) command, with extensions. It allows developers to use a wide range of encryption functions, without making drastic changes to their code. It allows users to encrypt files or data streams without having to be cryptographers. Above all, it allows you to have some really neat code on your machine.

Site Source : http://mcrypt.sourceforge.net/

Mcrypt is a powerful encryption library containing 22 block algorithms. Specifically, the following algorithms are supported:

Blowfish
Cast-256
DES
Enigma
Gost
LOKI97
Panama
RC2
RC4
RC4-iv
Rijndael-128
Rijndael-192
Rijndael-256
Safer-sk128
Safer-sk64 xtea
Saferplus
Serpent
Threeway
TripleDES
Twofish
Wake

Simple steps: follow these steps to compile Mcrypt and build the extension into your PHP distribution:

1. Download the Mcrypt library
2. gunzip mcrypt-x.x.x.tar.gz
3. tar -xvf mcrypt-x.x.x.tar
4. ./configure –disable-posix-threads
5. make
6. make install
7. cd to your PHP directory.
8. ./configure -with-mcrypt=[dir] [--other-configuration-directives]
9. make
10. make install

However, complex and complete steps are given below :

FYI – My machine stats are:
Cent OS 5.0
Apache 2.0
PHP 5.0

Ready? Here’s how you do it.

As root:

1) Install libmcrypt (2.5.x or better) http://mcrypt.hellug.gr/lib/index.html
-download and uncompress: tar z -xvf xxx.tar.gz
-cd into libmcrypt dir and type: ./configure
-when configure is done type: make
-when make is done type: make install

2) Add the library dir to /etc/ld.so.conf
-edit /etc/ld.so.conf and add: /usr/local/lib
-save file and then type the command: ldconfig

3) Update/Install Mhash (0.8.15 or newer) http://mhash.sourceforge.net/
-download and uncompress: tar z -xvf xxx.tar.gz
-cd into libmcrypt dir and type: ./configure
-when configure is done type: make
-when make is done type: make install
-when make install is done type: ldconfig

4) Install latest version of mcrypt (2.6.x or better) http://mcrypt.hellug.gr/mcrypt/index.html
-download and uncompress: tar z -xvf xxx.tar.gz
-cd into mcrypt dir and type: ./configure
-when configure is done type: make
-when make is done type: make install
-when make install is done type: ldconfig

5) Take note of your current php info
-create a file somewhere on your webserver called phpinfo.php
-edit the file and add the single line:
-make sure a normal user owns the file (not root – ie: chown user.user phpinfo.php)
-issue the command: chmod 755 phpinfo.php
-open the file in a web browser ie: www.yourserver.com/phpinfo.php
-copy the contents of “Configure Command” to a text file somewhere.
-It will look something like this (probably all on 1 line – leave it on 1 line):
‘./configure’ ‘–with-apxs=/usr/local/apache/bin/apxs’ ‘–with-xml’ ‘–enable-bcmath’
‘–enable-calendar’ ‘–enable-ftp’ ‘–enable-magic-quotes’ ‘–with-mysql’ ‘–with-pear’
‘–enable-sockets’ ‘–enable-track-vars’ ‘–enable-versioning’ ‘–with-zlib’
-edit the command to remove all the ‘ ‘ marks so it looks like this:
./configure –with-apxs=/usr/local/apache/bin/apxs –with-xml –enable-bcmath –enable-calendar
–enable-ftp –enable-magic-quotes –with-mysql –with-pear –enable-sockets –enable-track-vars
–enable-versioning –with-zlib
-at the end, add the following (assuming mcrypt is actually found in /usr/local/bin/mcrypt):
–with-mcrypt=/usr/local/bin/mcrypt
-save the text file.

6) Go into your php source directory : /home/cpapachebuild/buildapache/php-4.3.1/
-type: make clean
-type: rm config.cache (yes, remove that file)
-issue your command you saved in the text file. Something like this:
./configure –with-apxs=/usr/local/apache/bin/apxs –with-xml –enable-bcmath –enable-calendar
–enable-ftp –enable-magic-quotes –with-mysql –with-pear –enable-sockets –enable-track-vars
–enable-versioning –with-zlib –with-mcrypt=/usr/local/bin/mcrypt
-when that is done, type: make
-when that is done, type: make test (most tests will fail… about 50%-60% or so)
-when that is done, type make install

or

enable support for php. requires php-mcrypt and php-mhash packages:

yum install php-mcrypt*
yum install php-mhash*

7) Restart Apache
-issue the command: service httpd restart
-go back to your phpinfo.php page and check to see that –with-mcrypt now shows up in the “Configure Command”

Question:
I am trying to have mcrypt support in php. I installed libmcrypt and mhash using yum. They installed okay, but they weren’t added to phpinfo(), so they do not work.
Reading mcrypt info it says I need to recompile php.

Answer: It is working!

While I was requiring to recompile php according to the information on the mcrypt package to enable mcrypt support. I found an alternative.

There are 2 solutions to this problem:
A) This is the painless way to do it.
After a lot of research, as I couldn’t find answers on forums and other places. I found on sourceforge.net they released some rpm packages to integrate mcrypt and mhash with php.

First we need to install mcrypt and mhash as follows:

1) Install mcrypt & mhash

yum install mcrypt*
yum install mhash*

answer y to the question if matched your system (it should).

If it comes out

Setting up Install Process
Parsing package install arguments
No package mcrypt available.
Nothing to do

Manually install from the source after compiling as indicated from the start or the post.

2) enable support for php. requires php-mcrypt and php-mhash packages:

yum install php-mcrypt*
yum install php-mhash*

If you get an error saying packages not signed (unsigned packages), do the following:
edit /etc/yum.conf
change:
gpgcheck=1 to gpgcheck=0

attempt step 2 again. Once completed change back yum.conf

分享到:
评论

相关推荐

    docker linux下安装为PHP安装mcrypt模块

    我的docker是php 7.34. 安装mcrypt 一开始按网上教程,装php71d中的三个模块,三个步骤。没成功,最后一个模块卡住了。 再搜索发现: mcrypt 扩展从 php 7.1.0 开始废弃;自 php 7.2.0 起,会移到 pecl。 于是,在...

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

    6. 测试mcrypt模块是否正确加载: 创建一个名为`info.php`的文件,将其内容设置为: ```php echo phpinfo(); ?> ``` 将这个文件放在Apache的Web根目录`/usr/local/apache2/htdocs/`下。 确保Apache的80端口正在...

    php-mcrypt-5.3.3-1.el6.i686.rpm libmcrypt-2.5.8-9.el6.i686.rpm php mcrypt扩展

    在Linux环境中,PHP的Mcrypt扩展是一个非常重要的组件,它为PHP提供了对各种加密算法的支持,包括AES、DES、3DES等。...通过上述步骤,应该可以成功地在Linux环境下安装和启用PHP的Mcrypt扩展,恢复正常的功能使用。

    Linux下PHP及组件的安装

    总结,安装Linux下的PHP和其组件需要一定的Linux基础和对软件编译安装的理解。遵循上述步骤,确保每个依赖项都正确安装,才能使PHP环境正常运作。在实际操作过程中,可能会遇到版本兼容性或权限问题,遇到这些问题时...

    PHP加密扩展库Mcrypt安装和实例

    Mcrypt扩展库在Linux环境下默认不开启,而在Windows环境下,PHP 5.3及以上版本默认会开启Mcrypt扩展。安装Mcrypt扩展库的过程相对简单,在PHP的配置文件php.ini中,找到libmcrypt.dll文件,并将前面的分号注释去掉,...

    linux资料库总结(lampp安装与配置文档)

    解决方法包括在PHP源代码中启用mcrypt模块再重新编译,或者在已安装的PHP环境中使用PECL安装mcrypt扩展。确保在php.ini配置文件中开启该扩展,并重启PHP服务。 4. 如何安装双系统 安装双系统意味着在一台计算机上...

    linux下安装配置apache+php.pdf

    本文主要介绍如何在Linux环境下安装和配置Apache Web服务器以及PHP解析器,以构建一个基础的LAMP(Linux、Apache、MySQL、PHP)环境。首先,我们来看看使用YUM工具进行安装的方法,然后讲解编译安装的步骤。 **A. ...

    linux下安装配置apache+php (2).pdf

    本文主要介绍如何在Linux环境下安装和配置Apache Web服务器以及PHP解析器,以构建一个基础的LAMP(Linux、Apache、MySQL、PHP)环境。以下是详细步骤: A. 使用Yum安装Apache和PHP 1. **安装Apache**: - `yum ...

    X64 linux centos下编译安装PHP环境

    在安装PHP之前,必须先安装一系列必要的库,包括jpeg、zlib、libpng、freetype、libiconv、libxml、libxslt、gd、libmcrypt、mhash、mcrypt、cmake、bison、mysql、apr、apr-util、pcre、httpd和curl。这些库的顺序...

    在linux下面安装apache、mysql、php

    在Linux环境下搭建Web服务,通常涉及Apache(HTTP服务器)、MySQL(数据库服务器)和PHP(脚本解释器)的安装与配置。以下将详细介绍如何在Linux系统中安装这三款软件,以及解决可能出现的问题。 首先,我们来看...

    linux下的PHP安装

    ### Linux下的PHP安装知识点详解 在Linux环境下安装PHP是一项常见的任务,尤其对于Web开发者来说更是如此。本篇文章将详细介绍如何在Linux系统上安装PHP,并解释`./configure`命令中的各个选项的意义及其作用。 ##...

    php离线安装所需要的扩展

    本文将详细讲解如何在Linux系统下离线安装PHP所需的扩展,以及为何这种安装方式对于某些环境至关重要。 离线安装PHP扩展通常在无法连接到互联网或者网络环境不稳定的情况下非常实用。在描述中提到的场景中,我们有...

    linux下安装php编译参数.docx

    在Linux环境下安装PHP时,通常采用源代码编译的方式,因为这种方式允许用户自定义配置参数,以满足特定的需求和系统环境。以下是一些常见的编译参数及其详细说明: 1. **--prefix=/usr/local/php**:指定PHP安装的...

    Linux下Apache+php+mysql教程.docx

    在Linux环境下搭建Apache、MySQL和PHP(通常称为LAMP)服务器是常见的Web开发配置。这个过程包括安装一系列的软件组件,以创建一个功能齐全的Web服务器,能够处理动态内容和数据库交互。以下是对LAMP环境安装的详细...

    linux安装apache、php步骤.doc

    以下是如何在Linux上安装配置Apache和PHP的详细步骤。 首先,我们需要安装Apache Web服务器。Apache是最流行的开源Web服务器,它的安装通常可以通过包管理器如yum或apt-get进行。对于没有包管理器或者需要特定版本...

Global site tag (gtag.js) - Google Analytics