Need help? Call us on 1300 789 260

Install PHP Mcrypt on CentOS 7 VPS

Difficulty: Advanced

Prerequisites

  • SSH access to your VPS

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

  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
    =========================================================
    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 [y/d/N]: 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!
    
  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
    mcrypt
Was this article helpful? Yes No
👥

Having trouble? We’re here to help!

We’ve built our company with a serious focus on quality service. Feel free to give us a call!

1300 789 260