Install php-mcrypt on CentOS 6

All we need is an easy explanation of the problem, so here it is.

I have been trying to install php-mcrypt for a while now. Everytime I get the “No package php-mcrypt available.” returned to me. Here’s what I’ve tried:

[email protected]********** [~]# yum install php-mcrypt --enablerepo=centosplus (<- both with and without this)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: p3plmirror01.prod.phx3.secureserver.net
* centosplus: p3plmirror01.prod.phx3.secureserver.net
* epel: mirrors.solfo.com
* extras: p3plmirror01.prod.phx3.secureserver.net
* updates: p3plmirror01.prod.phx3.secureserver.net
centosplus                                               | 3.5 kB     00:00
centosplus/primary_db                                    | 746 kB     00:00
Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do

I have made sure to install the EPEL repository. At this point I’m just stumped. I’ve followed EVERY tutorial I’ve found online and get the same error.

Notes: Go Daddy VPS, CentOS 6.4 64-bit, mcrypt installed without a hitch, but no php-mcrypt.

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

I had the same issue, and found the previous suggestions gave me enough info to get it working on my server. The following is what I did:

1) Install EPEL repository (From: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x):

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

2) Install it via:

yum update
yum install php-mcrypt*

The yum update updated the repository reference on my server then the 2nd command got what I needed 🙂

3) Restart your webserver. For my apache install I did:

service httpd restart

Method 2

For me the answer was:

1) Get the Repos from

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

2) Install it via:

sudo yum update
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:

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.

Method 3

Updated Answer for centos 7

 ## RHEL/CentOS 7 64-Bit ##
 # wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
 # rpm -ivh epel-release-7-0.2.noarch.rpm

For CentOS 6

 ## RHEL/CentOS 6 32-Bit ##
 # wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
 # rpm -ivh epel-release-6-8.noarch.rpm

 ## RHEL/CentOS 6 64-Bit ##
 # wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 # rpm -ivh epel-release-6-8.noarch.rpm

Install

 yum install php-mcrypt

Edit: See comments for updated repositories.

Method 4

yum install php-mcrypt.x86_64

worked for me instead of

yum install php-mcrypt

Method 5

I was able to figure this out; it was a lot simpler then I thought. Under the WHM manager go to: Home >> Software >> EasyApache (Apache Update) >> There you have two options “Build Profile” or “Customize Based On Profile”. I went Customize to keep my current config then followed the instructions on the page.

Eventually there was a place to add and remove php modules. There you will find ever module under the sun. Just select the one you want and rebuild the profile. It was really that simple.

Method 6

I got too much problem in installing php-mcrypt using epel-release-6-8.noarch.rpm. It has some dependency problem.

Then I tried in different way.

Get the php-mcrypt using “wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm” command.

Then install libmcrypt

ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm

The installed php-mcrypt using following command

yum install php-mcrypt-5.3.3-3.el6.x86_64.rpm

Method 7

If php_mcrypt installed on 64bit but reported missing by an installer, check the extension path:

vi /etc/php.d/mcrypt.ini

; Enable mcrypt extension module
;extension=module.so
extension=/usr/lib64/php/modules/mcrypt.so

Method 8

To install mcrypt from http://namhuy.net/641/centos-6-install-mcrypt-for-phpmyadmin.html

i386

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

x86_64

http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

then just use yum command to install the mcrypt package

yum install php-mcrypt

Method 9

The best way is to:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
yum localinstall php-mcrypt-5.3.3-3.el6.x86_64.rpm

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
yum localinstall libmcrypt-2.5.8-9.el6.x86_64.rpm

or go to: http://dl.fedoraproject.org/pub/epel/6/x86_64/ to match your version
check from your info.php that is ok — done!

Method 10

There are two ways you can address this:

Method 11

For me I had to add the EPEL repository. It is where my php-mcrypt came from:

[[email protected] ~]$ repoquery -i php-mcrypt

Name        : php-mcrypt
Version     : 5.3.3
Release     : 1.el6
Architecture: i686
Size        : 39225
Packager    : Fedora Project
Group       : Development/Languages
URL         : http://www.php.net/
Repository  : epel <----------
Summary     : Standard PHP module provides mcrypt library support
Source      : php-extras-5.3.3-1.el6.src.rpm
Description :
Standard PHP module provides mcrypt library support

You can enable the EPEL repo with the instructions here:

http://fedoraproject.org/wiki/EPEL

Method 12

installing php-mcrypt from Repoforge worked for me perfectly. Just add Repoforge from http://repoforge.org/ and simply run yum install php-mcrypt.

Method 13

For me, this worked :
yum install php-mcrypt*
and then, restart httpd service
service httpd restart

I tryed @VenomFangs solution but the first step was not needed for me. I already had a newer EPEL version installed. So, the first step following was not usefull, I backed to the snapshot I did before doing modifications and I just used the install and restart above commands.

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

CentOS Linux release 7.2.1511 (Core)

PS : I know this is not the subject, but if somebody needs it, the keyword can help. I needed to do this because of this error on prestashop. Two keywords I would be glad to use to find this informations are : “php_mycrypt.dll” “php_mcrypt.dll”
Fatal error: Call to undefined function mcrypt_encrypt() in /classes/Rijndael.php on line 46

EDIT 10/06/2016 :
Another Prestashop solution to try in “Advanced Parameters”, “Performance”, “Ciphering” (FR : Chiffrement), "Use the custom BlowFish class." instead of "Use Rijndael with mcrypt lib. (you must install the Mcrypt extension)."

Method 14

First find out your PHP version. In my case 5.6.

php --version

PHP 5.6.27 (cli) (built: Oct 15 2016 21:31:59)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Then:

sudo yum search mcrypt

And choose the best one for your version from the list, I used php56w-mcrypt.

  $ sudo yum search mcrypt
  Loaded plugins: fastestmirror
  Loading mirror speeds from cached hostfile

  ..... output truncated ....

libmcrypt-devel.i686 : Development libraries and headers for libmcrypt
libmcrypt-devel.x86_64 : Development libraries and headers for libmcrypt
libtomcrypt-devel.i686 : Development files for libtomcrypt
libtomcrypt-devel.x86_64 : Development files for libtomcrypt
libtomcrypt-doc.noarch : Documentation files for libtomcrypt
php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php55w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support

# either of these are fine:
php56-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php56w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support

php70-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php71-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
libmcrypt.i686 : Encryption algorithms library
libmcrypt.x86_64 : Encryption algorithms library
libtomcrypt.i686 : A comprehensive, portable cryptographic toolkit
libtomcrypt.x86_64 : A comprehensive, portable cryptographic toolkit
mcrypt.x86_64 : Replacement for crypt()
```

Finally:

sudo service httpd restart

Method 15

I was having same issue in centos 6.5

Finaly solution below worked for me

-go to http://dl.fedoraproject.org/pub/epel/6/x86_64/
-search for php-mcrypt(http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm)
-execute wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
-rpm -ivh php-mcrypt-5.3.3-3.el6.x86_64.rpm

if there are any dependencies you can download same using http://dl.fedoraproject.org/pub/epel/6/x86_64/

Method 16

For php 7 to install mcrypt run:

Centos:
sudo yum install php7.0-mcrypt to install

On Ubuntu:
sudo apt-get install php7.0-mcrypt

Method 17

If you want to recompile PHP with mcrypt enable.

1.
Insatll mcrypt. libmcrypt-devel is from Third Party Repositories EPEL, so you should:

yum --enablerepo=extras install epel-release
yum install libmcrypt-devel

2.
Append --with-mcrypt to your ./configure arguments:

./configure --with-mcrypt

3.
Build and install:

make & make install

Method 18

Try

yum clean all
yum remove epel-release
yum install epel-release

and finally

yum install php-mcrypt

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply