How to install PHP Mcrypt extension on Ubuntu 20.04 or Debian

What is the PHP Mcrypt extension?
PHP Mcrypt extension provides encryption facilities to web applications that need the functionality of modern algorithms such as AES. This extension works as an interface to the Mcrypt’s libmcrypt library which implements all the algorithms and modes found in it such as DES, TripleDES, Blowfish (default), SAFER-SK128, LOKI97, GOST, RC2, RC6, MARS, IDEA, RIJNDAEL-128 (AES), RIJNDAEL-192, TWOFISH, TEA, RC2, and more. However, PHP developers have removed it from the PHP package bundle since the launch of php7.2 because of no further development in Mcrypt, thus the extension also gets decrypted. Sodium (available as of PHP 7.2.0) and OpenSSL are now some alternatives to it.
However, the PHP Mcrypt extension has been moved to the PECL repository, thus if somebody wants, he or she can install it on Ubuntu 20.04 LTS using Pear. Here we will show how?
Go to Terminal, if you are using CLI server then you are already there. Simply run the system update command to refresh the repo cache and update the installed packages of the system.
sudo apt update
To install PHP Mcrypt on Ubuntu 20.04 or Debian, we have to install some tools needed to build packages from the source along with some developer dependency packages.

The below two commands will update the channels that allow Pear and Pecl to fetch packages-

Finally, use the Pecl command to download and install php-mcrypt extension on your system

Once the installation is complete to activate the extension we have to add it in the php.ini file of the system. For that simply edit the php.ini file and under Dynamic extension, type: beside other extensions, as shown in the screenshot.
Save the file ctrl+X, type Y, and hit the Enter key.

To ensure your web server has successfully recognized the enabled PHP mcrypt extension, reload the Apache server-


Related articles

Us Visa Appointment India

For those in India seeking a U.S. visa appointment,...

Us Embassy

What is the US Embassy? If you're planning a trip...

New Jeep Car

Buying a New Jeep Car When deciding to buy a...

Best Electric Cars 2022

Best Electric Cars 2022 While a number of electrified vehicles...

One Of Us Is Lying

How to Tell If a Character is Lying Karen M....