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. The following instructions will step you through the installation for a CentOS 7 based server.
Instructions
- SSH to VPS as the root user.
- Install the the latest "EPEL" repo:
yum install epel-release
- Install "php-mcrypt":
yum install php-mcrypt
Here's an example output:
[root@ws1 ~]# yum install php-mcrypt Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.overthewire.com.au * epel: mirror.overthewire.com.au * extras: centos.mirror.uber.com.au * updates: mirror.overthewire.com.au Resolving Dependencies --> Running transaction check ---> Package php-mcrypt.x86_64 0:5.4.16-3.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================= Package Arch Version Repository Size ========================================================= Installing: php-mcrypt x86_64 5.4.16-3.el7 epel 20 k Transaction Summary ========================================================= Install 1 Package Total download size: 20 k Installed size: 48 k Is this ok 2025: y Downloading packages: php-mcrypt-5.4.16-3.el7.x86_64.rpm | 20 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : php-mcrypt-5.4.16-3.el7.x86_64 1/1 Verifying : php-mcrypt-5.4.16-3.el7.x86_64 1/1 Installed: php-mcrypt.x86_64 0:5.4.16-3.el7 Complete!
- Restart Apache to apply the changes:
systemctl restart httpd
- You can also check to confirm that mcrypt has been installed:
[root@ws1 ~]# php -m | grep -i mcrypt mcrypt
