Linux

PHP Mcrypt is now being used more and more. Laravel won’t even install without it. Here the simplest way to install PHP Mcrypt on RedHat Linux.

Install PHP Mcrypt

yum install php-mcrypt

A check would be run. You will see a log that will look similar to this:

[user@yourvps ~]$ sudo yum install php-mcrypt
Failed to set locale, defaulting to C
Loaded plugins: amazon-id, rhui-lb, security
atomic                                                                                                                                | 1.9 kB     00:00     
atomic/primary_db                                                                                                                     | 1.1 MB     00:00     
...
rhui-REGION-rhel-server-rhscl                                                                                                         | 2.6 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mcrypt.x86_64 0:5.4.25-31.el6.art will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.25-31.el6.art for package: php-mcrypt-5.4.25-31.el6.art.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: php-mcrypt-5.4.25-31.el6.art.x86_64
--> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-5.4.25-31.el6.art.x86_64
...

Dependencies Resolved

=============================================================================================================================================================
 Package                         Arch                      Version                                 Repository                                           Size
=============================================================================================================================================================
Installing:
 php-mcrypt                      x86_64                    5.4.25-31.el6.art                       atomic                                               49 k
Installing for dependencies:
 libmcrypt                       x86_64                    2.5.8-9.el6                             epel                                                 96 k
 libtool-ltdl                    x86_64                    2.2.6-15.5.el6                          rhui-REGION-rhel-server-releases                     44 k
Updating for dependencies:
 php                             x86_64                    5.4.25-31.el6.art                       atomic                                              2.7 M
 php-cli                         x86_64                    5.4.25-31.el6.art                       atomic                                              2.6 M
... 

Confirm Download.

At the end of the log, you will be asked if you agree to download the packages. Type y and press enter to confirm.

Total download size: 9.3 M
Is this ok [y/N]: Y
Downloading Packages:
(1/10): libmcrypt-2.5.8-9.el6.x86_64.rpm                                                                                              |  96 kB     00:00     
(2/10): libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm                                                                                        |  44 kB     00:00     
(3/10): php-5.4.25-31.el6.art.x86_64.rpm                                                                                              | 2.7 MB     00:01     
(4/10): php-cli-5.4.25-31.el6.art.x86_64.rpm                                                                                          | 2.6 MB     00:00     
(5/10): php-common-5.4.25-31.el6.art.x86_64.rpm                                                                                       | 927 kB     00:00     
(6/10): php-devel-5.4.25-31.el6.art.x86_64.rpm                                                                                        | 2.5 MB     00:00     
(7/10): php-mcrypt-5.4.25-31.el6.art.x86_64.rpm                                                                                       |  49 kB     00:00     
(8/10): php-mysql-5.4.25-31.el6.art.x86_64.rpm                                                                                        | 135 kB     00:00     
(9/10): php-pdo-5.4.25-31.el6.art.x86_64.rpm                                                                                          | 119 kB     00:00     
(10/10): php-xml-5.4.25-31.el6.art.x86_64.rpm                                                                                         | 169 kB     00:00     
.....                                  
Dependency Updated:
  php.x86_64 0:5.4.25-31.el6.art         php-cli.x86_64 0:5.4.25-31.el6.art   php-common.x86_64 0:5.4.25-31.el6.art   php-devel.x86_64 0:5.4.25-31.el6.art  
  php-mysql.x86_64 0:5.4.25-31.el6.art   php-pdo.x86_64 0:5.4.25-31.el6.art   php-xml.x86_64 0:5.4.25-31.el6.art     

Complete!

Restart your webserver

[user@yourvps ~]$ sudo service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]