Install PHP Mcrypt on CentOS

Overview

The PHP module “Mcrypt” provides encryption and decryption using algorithms such as DES, TripleDES and Blowfish. You can read more about it on the official PHP Mcrypt page.

This is required by eCommerce systems such as Magento, however it’s not part of the standard RHEL / CentOS packaging.

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.

The php-mcrypt package is available (for CentOS, Scientific Linux, and Oracle Linux administrators) from the RPMforge repository and from the EPEL repository.

 

How to install mcrypt ?

First, add the repository. For example, to add EPEL:

Then, install the php-mcrypt module:

If you see this —-> its OK 🙂

yum install php-mcrypt.x86_64
oaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* atomic: www7.atomicorp.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mcrypt.x86_64 0:5.3.17-10.el5.art set to be updated
--> Processing Dependency: php-common = 5.3.17-10.el5.art for package: php-mcrypt
--> Running transaction check
---> Package php-common.x86_64 0:5.3.17-10.el5.art set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================
Package                                                   Arch                                                  Version                                                          Repository                                             Size
==============================================================================================================================================================================================================================================
Installing:
php-common                                                x86_64                                                5.3.17-10.el5.art                                                atomic                                                1.0 M
replacing  php53-common.x86_64 5.3.3-13.el5_8
php-mcrypt                                                x86_64                                                5.3.17-10.el5.art                                                atomic                                                 48 k
Transaction Summary
==============================================================================================================================================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)
Total size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : php-common                                                                                                                                                                                                             1/3
warning: /etc/php.ini created as /etc/php.ini.rpmnew
Installing     : php-mcrypt                                                                                                                                                                                                             2/3
Erasing        : php53-common                                                                                                                                                                                                           3/3
Installed:
php-common.x86_64 0:5.3.17-10.el5.art                                                                                 php-mcrypt.x86_64 0:5.3.17-10.el5.art
Replaced:
php53-common.x86_64 0:5.3.3-13.el5_8
Complete!

 

* Recommended to restart Apache service:

 

To check if installation was successful:

or

 

Good luck !