How to Install php-mcrypt on CentOS 6.2

PHP is a server-side scripting language that is widely used for web development. mcrypt is an encryption library that is used to secure data transmission between the client and server.

The mcrypt exension is missing. Please check your PHP configuration.

In this guide, we will show you how to install php-mcrypt on CentOS 6.2.

Step 1:

Before installing the php-mcrypt module, make sure you have the EPEL repository installed on your CentOS 6.2 server. If it is not installed, you can install it using the following command:

sudo yum install epel-release

Step 2:

Once the EPEL repository is installed, you can install the php-mcrypt module using the following command:

sudo yum install php-mcrypt

The output:

[root@centos62 ~]# yum install php-mcrypt -y
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/metalink                                                                | 4.0 kB     00:00
 * base: centos.maulvi.net
 * epel: mirror01.idc.hinet.net
 * extras: centos.maulvi.net
 * rpmforge: fr2.rpmfind.net
 * updates: centos.maulvi.net
CentOS6.2-Repository                                                         | 4.0 kB     00:00 ...
CentOS6.2-Repository/primary_db                                              | 3.5 MB     00:00 ...
base                                                                         | 3.7 kB     00:00
base/primary_db                                                              | 3.5 MB     00:33
epel                                                                         | 4.3 kB     00:00
epel/primary_db                                                              | 3.5 MB     00:40
extras                                                                       | 3.5 kB     00:00
extras/primary_db                                                            | 6.4 kB     00:00
rpmforge                                                                     | 1.1 kB     00:00
rpmforge/primary                                                             | 1.5 MB     00:21
rpmforge                                                                                  4248/4248
updates                                                                      | 3.5 kB     00:00
updates/primary_db                                                           | 1.1 MB     00:13
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mcrypt.i686 0:5.3.3-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                   Arch                Version                    Repository           Size
====================================================================================================
Installing:
 php-mcrypt                i686                5.3.3-1.el6                epel                 18 k

Transaction Summary
====================================================================================================
Install       1 Package(s)

Total download size: 18 k
Installed size: 38 k
Downloading Packages:
php-mcrypt-5.3.3-1.el6.i686.rpm                                              |  18 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : php-mcrypt-5.3.3-1.el6.i686                                                      1/1

Installed:
  php-mcrypt.i686 0:5.3.3-1.el6

Complete!

Step 3:

After the installation is complete, you need to restart the Apache web server to load the new module. You can do this using the following command:

sudo service httpd restart

Step 4:

To verify that the php-mcrypt module is installed correctly, you can create a PHP file with the following content:

<?php
phpinfo();
?>

Save the file and place it in your web server’s document root directory, usually /var/www/html/. Now, open your web browser and go to http://your_server_ip/info.php. You should see a page with a lot of information about your PHP installation. Look for the “mcrypt” section, and it should say “enabled”.

See also  How to Configure Linux NFS Server on CentOS 6.2

Commands Mentioned:

  • sudo yum install epel-release – installs the EPEL repository
  • sudo yum install php-mcrypt – installs the php-mcrypt module
  • sudo service httpd restart – restarts the Apache web server

Conclusion:

In this guide, we have shown you how to install the php-mcrypt module on CentOS 6.2. This module is essential if you want to encrypt data transmission between the client and server. After following the steps in this guide, you should have successfully installed the php-mcrypt module and verified that it is enabled by creating a PHP file with the phpinfo() function. If you have any comments or suggestions for improvements, please let us know.

Comments

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *