Here’s a brief tutorial that shows you how to install mCrypt PHP extension in CentOS 7.  For some reasons this PHP extension isn’t available from CentOS 7 default repositories. You may be able to install other PHP extensions right out of the box after installing CentOS, but not PHP-mCrypt.

In other Linux distributions like Ubuntu and openSUSE, one could easily install mCrypt right after installing those operating systems, but not CentOS 7. Few users who read our blogs here was wondering the same thing, so we decided to write a brief tutorial on how to install it in CentOS 7 for those who don’t know.

CentOS 6 and 6.5 allow you to install PHP-mCrypt easily right after installing CentOS. The reason mCrypt is removed by default from version  7 is still unknown, but we’re going to show you how to re-enable it.

Some PHP applications depend on mCrypt. We recently showed you how to install Magento eCommerce application, and one of its requirements  is to enable PHP-mCrypt.  Without php-mCrypt, Magento won’t function.

If you find yourself needing to install this package, continue below to learn how.


Since the package isn’t readily available from CentOS 7 default repositories, you must enable external repositories that contain the package. One of the many repositories to install in CentOS 7 is the EPEL repository.

This repository contains many valuable and great Linux applications that don’t come installed in CentOS, Fedora or RedHat Linux. To enable the EPEL repository in CentOS 7, run the commands below to download the repository file.

cd /tmp/ && wget


Next, run the commands below to install the repository you just downloaded.

sudo yum install epel-release-7-1.noarch.rpm


Finally, run the commands below to install PHP-mCrypt.

sudo yum install php-mcrypt*


Restart Apache

sudo systemctl restart httpd.service


Restart Nginx

sudo systemctl restart nginx.service


That’s how you install PHP-mCrypt in CentOS 7.  If you have another method, please feel free to show us in your comment section. Our readers will appreciate it.