How to install mcrypt in Linux (Cent OS) and recompile php?

Posted by Jiltin     4 June, 2009    30,010 views   

mycrypt.jpgI realized that I need to install mcrypt libraries in order to operate your php encryption. In addition to installing mcrypt, I will have to re-compile php in order to include the support for mcrypt. Initially, I struggled hard and finally made it work. Hence, I am sharing this information whatever I collected from internet and tested at my site.

This has worked for me numerous times without anything breaking or failing to operate. Obviously, I’m not responsible for whether you try this or not. A healthy and current backup is always a good idea before diving into the world of re-compiling software packages.

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

Following Google Searches Lead To This Post: php install mycrypt
yum libmcrypt centos
redhat enterprise linux php mcrypt
howto recompile php Missing zlib extensions
install mcrypt centos
php basic installation mysql mcrypt
compiler extension php mcrypt linux
php5-mcrypt centos 5
install mcrypt php rhel
add mcrypt to php linux
mcrypt symbolic
install mcrypt ssh
No package mcrypt* available.
checking whether mhash >= 0.8.15… no
yum install mcrypt no pages?
BCMath centos
manually compile mcrypt apache
PHP: CentOS: Mcrypt install
mycrypt.so
Couldn’t find package mcrypt
mcrypt centos
manually install a library in centos
centos recompile php
mcrypt install centos
enable mcrypt onlinux
mcrypt enable
redhat yum install crypt
enable mcrypt centos
where disable posix centos
redhat mcrypt yum
how to enable blowfish encryption in centos
centos mcrypt
centos install mcrypt
pear install mcrypt
php mcrypt centos
install php extension mcrypt in linux
linux Mcrypt install
installer mcrypt centos
enable POSIX centos
Blowfish rpm package centos
Blowfish centos
How to install mcrypt extension in linux
set up php mcrypt extension on centos 5
mcrypt rpm Centos 4
centos4 mcrypt
yum php mycrypt
mcrypt for linux
how to compile php extension mcrypt
installing php hmac plugin
install php-posix
install mcrypt + CentOS
mcrypt mac installation
enable installing not signed package in centos
check if mcrypt is installed
pear mcrypt
rpm mcrypt RHEL centos 64
mcrypt php centos
install libmcrypt CentOS
mcrypt oracle
No package mcrypt available
mcrypt + linux
The extension ‘zlib’ couldn’t be found. centos
redhat how to install mhash and link
install mcrypt.so ssh
yum No package libmcrypt available
install mhash, libmcrypt and mcrypt in php5
centos how install php5-mcrypt
how to install libmcrypt on centos
libmcrypt mcrypt centos yum
php5 BCmath centos
centos install php5-mcrypt
reinstall php on centos
cryptography extension mcrypt
install libmcrypt on centos
how to install DBA on centos
“yum install php-mhash” redhat
redhat RHEL php-mcrypt install
yum install libmcrypt
centos mcrypt package
php5-mcrypt centos
Linux установка mcript
php5-mcrypt on centos
yum install libmcrypt.so.4
php5-mcrypt pour serveur centos
No package php-mcrypt available.
lamp enable mcrypt
linux mcrypt
recompile php
how to install mcrypt with pear
install php5-mcrypt on centos
PHP POSIX Support yum
compile mcrypt.so
enazble Mcrypt over ssh
mcrypt php info
centos instal mcrypt
redhat php mcrypt support
add mcrypt to php yum
how to install crypt in linux
extension mcrypt mac
install mcrypt
yum install php5-mcrypt
installing php with mcrypt blowfish configure
the extension zlib couldn’t be found
disable enable php posix
how to install mcrypt extension via ssh
install mcrypt php extension from ssh
install mcrypt php extension from ssh redhat
yum php5-mcrypt
mcrypt rpm rhel
linux php install mcrypt
centos 4.3 mcrypt
download php5-mcrypt centos 5
howto install mcrypt
libmcrypt centos 5
mcrypt centos yum
compiling mcrypt centos
php-mhash centos
php “–enable-posix” redhat
test mycrypt
centos instalar BC Math library
how install crypt red hat
yum mcrypt on redhat linux
“No package mcrypt available.”
instalar php5-mcrypt
“recompile php” mcrypt
mcrypt.so rhel 64
No package mcrypt* available. Nothing to do
libmcrypt.so.4 ssh install
enable MCRYPT php linux\
enable mcrypt on linux
Recompile php with gd and mcrypt
linux php gd mcrypt apache
mac install mcrypt
compile php5.3 “–with-mcrypt=” centos
steps to install mcrypt
mcrypt installed but not in phpinfo
mcrypt enabled but not in phpinfo
php5-mcrypt redhat
php-mcrypt centos 64 rpm
configurare MAC Centos
mcrypt centos 4
make test php mcrypt fail test
linux yum install ldconfig
установить mycrypt на Mac
how to enable MCRYPT extensions for PHP on linux server
install mcrypt modules php 5 on linux centos
instalar mcrypt php linux
php5-mcrypt rpm centos
Missing zlib extensions centos
recompile yum centos
installing mcrypt on centos
how to install mcrypt in cent os
lib mcrypt centos
linux instalar mcrypt
how to add mcrypt with yum
how to install mcrypt on centos 64
centos posix extension missing
mac os x php mhash
install mcrypt library on centos 5
recompile php centos 5
PHP’s POSIX install centos 5
yum install php-posix
linux yum php5-mcrypt
mcrypt.so centos
libmcrypt.so.4 is needed by php-mcrypt centos
install mcrypt on centos
centos installing mcrypt extension
instalando o mcrypt
mcrypt pear
enable mcrypt
linux install mcrypt php extension
centos install php-mcrypt
yum install php-mcrypt no package php-mcrypt available
how to check whether php mcrypt installed in linux
install mcrypt php + red hat
php enable posix yum
yum install crypt rpm
mcrypt yum RHEL
mcrypt install in linux
redhat yum No package php-mcrypt available
enable php-posix
The extension ‘zlib’ couldn’t be found.
centos mcrypt yum
howto install mhash mcrypt centos
“libmcrypt” centos
install php5-posix on centos
libmcrypt.so.4 +rpm
linux mcrypt configure command
install mcrypt linux
mcrypt phpinfo()
redhat enterprise mcrypt install
mcrypt on centos
php installing mcrypt source
how to enable mcrypt in linux command
recompile php yum
how to enable mcrypt in lamp
No package mcrypt available.
mcrypt+gd+php+linux
install and recompile php with mcrypt enabled in linux
centos “php-posix”
php-mcrypt centos
instalando o mcrypt.so
installing mcrypt redhat enterprise 5
add mycrypt to php
how to yum install php with posix
how to install mcrypt on redhat linux
sha-2 hash function rpm
how to remove mcrypt linux
compiling mcrypt on linux
yum install php-bcmath
how to install php-mcrypt on RHEL
installing “php extensions” yum linux
enable mycrypt library
centos php5 mcrypt
rpm: enable mcrypt php
“libmcrypt.so.4 is needed by package”
installer mcrypt sous centos
mcrypt centos4
php-mcrypt centos 4
“The mcrypt PHP extension is not available; PHP will need to be recompiled”
The mcrypt PHP extension is not available; PHP will need to be recompiled
instalar mcrypt red hat php
yum instal php crypt
extensión mcrypt linux
how to test whether mcrypt is installed
redhat enterprise mcrypt
linux mcrypt.so install
php install mcrypt.so centos
recompile php centos with pear
mcrypt rpm centos
centos 4 installing unsigned packages
oracle linux 5 mcrypt
centos install posix
php5-mcrypt redhat rpm
how to enable mcrypt extention
install php-mcrypt centos
php5-mcrypt download for red hat 5
centos install php mcrypt
yum install crypt
centos yum install libmcrypt
php ssh install mcrypt
mcrypt in centos
how to install mcrypt library
enable mcrypt on MAC
centos crypt install
Install php mcrypt in centos 4
php mcrypt centos 4
modules\mod_ twitter\twitter lib.php on line 164
yum install php-mcrypt nothing to do
installer extension mcrypt linux
php mycrypt 64
centos blowfish
Cryptography extension mcrypt is not enabled or installed
/usr/lib/libmcrypt.so.4 is not a symbolic link
mcrypt unix download
centos 64 mcrypt
mycrypt instal
how to install php encrypt in linux
mcrypt on linux
blowfish mcrypt php centos package
enable ftp in php linux and recompile
POSIX php yum
install mcrypt php extension on centos
how to tell if you have mcrypt linux
centos enabling pear
yum “No package mcrypt available.”
mcrypt how to
install mcrypt centos 4
установить mcrypt на centos
install libmcrypt centos5
install libmcrypt rpm in centos
mcrypt linux php
how to remove mcrypt
mcrypt php install
remove mcrypt
centos mcrypt install
centos yum mcrypt
install mcrypt on linux for red hat enterprise
recompile yum package
enable “php posix” extension “redhat”
how to install php-mcrypt in red hat enterprise
how to enable mcrypt function
php install mcrypt pear
yum install mcrypt centos
how to install mcrypt php
php-mcrypt in red hat enterprise
mcrypt+centos
yum install mcrypt
how to enable mcrypt on linux
c# et centos
centos 4 mcrypt
install mycrypt on linux
installer mcrypt serveur linux
php mcrypt install centos mcrypt 64
enable POSIX php support centos
php mcrypt install pear
mcrypt oracle enterprise linux
libmcrypt centos
Cryptography extension mcrypt is not enabled or in
howto enable PHP Posix Library
recompile apache in order to get Mcrypt installed
pear mcrypt install
blowfish on centos
descargar mcrypt para centos
blowfish with centos
mcrypt download centos
Categories : Reviews, Web & Scripts Tags : , , ,

Comments

No comments yet.


Leave a comment

(required)

(required)