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.


  1. SSH to VPS as the root user.
  2. Install the the latest "EPEL" repo: 
    yum install epel-release
  3. 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
     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 2024: 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 
      php-mcrypt.x86_64 0:5.4.16-3.el7                                                                                                                                       
  4. Restart Apache to apply the changes:
    systemctl restart httpd
  5. You can also check to confirm that mcrypt has been installed:

    [root@ws1 ~]# php -m | grep -i mcrypt


Was this article helpful?

Related Articles