Seems like new versions of the Amazon AMI on EC2 don't have the php-mcrypt package available. How do I get it?

$ sudo yum install php-mcrypt
Loaded plugins: langpacks, priorities, update-motd
No package php-mcrypt available.
Error: Nothing to do

In general, how do I figure out how to solve "missing packages" problems like this?

  • Explicitly setting the version is not a solution. php54- packages are also all missing.
    – Meekohi
    Feb 1, 2018 at 19:10
  • sudo yum info php and php -v indicate version is php 5.4.16
    – Meekohi
    Feb 1, 2018 at 19:11
  • They don't ship it. Use something other than Amazon Linux. Feb 1, 2018 at 19:14

3 Answers 3


I was able to install php-mcrypt following the suggestion on this page using EPEL for EL 7 into AWS release 2.0 (2017.12) Linux.

This is an Amazon instance running Amazon Linux 2 (2017.12) which I tested with...

# cat /etc/system-release
Amazon Linux release 2.0 (2017.12) LTS Release Candidate
# curl

The people at amazon claim that AWS distro is not based specifically on any version of RedHat, so there is no guarantee of compatibility, but comparing the versions of the PHP packages in EPEL for Enterprise linux 7, and the amazon ones, suggests they are building from the same source;

for example the build numbers are exactly the same Version : 5.4.16 on the packages from amzn2-core and epel

Name        : php-mcrypt
Version     : 5.4.16
Release     : 7.el7
From repo   : epel


Name        : php
Version     : 5.4.16
Release     : 43.amzn2.0.1
From repo   : amzn2-core

So I am not surprised the package from epel installed on the 2017.12 AWS AMI no problem...

# yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  Installing : epel-release-7-11.noarch        1/1
  Verifying  : epel-release-7-11.noarch        1/1

  epel-release.noarch 0:7-11


and then installed php-mcrypt;

# yum install -y --enablerepo=epel php-mcrypt
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libmcrypt-2.5.8-13.el7.x86_64      1/2 
  Installing : php-mcrypt-5.4.16-7.el7.x86_64     2/2 
  Verifying  : libmcrypt-2.5.8-13.el7.x86_64      1/2 
  Verifying  : php-mcrypt-5.4.16-7.el7.x86_64     2/2 

  php-mcrypt.x86_64 0:5.4.16-7.el7                                                                                                    

Dependency Installed:
  libmcrypt.x86_64 0:2.5.8-13.el7                                                                                                     


and then you can test to see that mcrypt extensions is installed like so;

# php -i "(command-line 'phpinfo()')" | grep mcrypt
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

I also disabled epel, as I don't want to end up with a mix of packages from both repos beyond the minimum;

yum-config-manager --disablerepo=epel

# yum repolist all
Loaded plugins: langpacks, priorities, update-motd
repo id                      repo name                                                                  status
amzn2-core/2017.12/x86_64    Amazon Linux 2 core       enabled: 7,157
epel/x86_64                  Extra Packages            disabled
  • 1
    Be careful. Amazon Linux 2 might be forked from CentOS 7, but that doesn't mean compatibility is guaranteed. This has historically been a serious problem with Amazon Linux. If you want to be sure of compatibility, just save yourself a lot of trouble and go with CentOS 7. Feb 1, 2018 at 23:15
  • Ah, indeed. I only span the instance up to do the test! Currently most of my work is migrating from EL6 to EL7 using ansible...
    – Tom
    Feb 1, 2018 at 23:29

I have been searching it a lot and got it working.

Try This.

# amazon-linux-extras install epel
# yum install php-mcrypt
  • 1
    The same compatibility warning applies here. You should expect this to break in the future. Mar 28, 2019 at 17:08

Found an even easier solution. Just run:

yum install php-pecl-mcrypt

This works for PHP 7.3 and on Amazon Linux 2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .