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:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Then, install the php-mcrypt module:
# yum install php-mcrypt
If you see this —-> its OK 🙂
yuminstallphp-mcrypt.x86_64oaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* atomic: www7.atomicorp.comSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package php-mcrypt.x86_64 0:5.3.17-10.el5.artsetto be updated--> Processing Dependency: php-common = 5.3.17-10.el5.artforpackage: php-mcrypt--> Running transaction check---> Package php-common.x86_64 0:5.3.17-10.el5.artsetto be updated--> Finished Dependency ResolutionDependencies Resolved==============================================================================================================================================================================================================================================Package Arch Version Repository Size==============================================================================================================================================================================================================================================Installing:php-common x86_64 5.3.17-10.el5.art atomic 1.0 Mreplacing php53-common.x86_64 5.3.3-13.el5_8php-mcrypt x86_64 5.3.17-10.el5.art atomic 48 kTransaction Summary==============================================================================================================================================================================================================================================Install 2 Package(s)Upgrade 0 Package(s)Total size: 1.1 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning TransactionInstalling : php-common 1/3warning:/etc/php.ini created as/etc/php.ini.rpmnewInstalling : php-mcrypt 2/3Erasing : php53-common 3/3Installed:php-common.x86_64 0:5.3.17-10.el5.art php-mcrypt.x86_64 0:5.3.17-10.el5.artReplaced:php53-common.x86_64 0:5.3.3-13.el5_8Complete!
* Recommended to restart Apache service:
service httpd restart
To check if installation was successful:
[root@sergeyb]# yum list installed | grep mcrypt
or
[root@sergeyb]# php -r "echo phpinfo();" | grep "^mcrypt" mcrypt mcrypt support => enabled mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value
Good luck !
