The mcrypt extension has been abandonware for some time already, and was also fairly complex to use. It has therefore been deprecated by PHP developers in favor of OpenSSL in PHP 7.1, and it was removed from the core and moved into PECL in PHP 7.2.
Here is another guide on how to install PECL extension under Linux.
You can find our previous guide for installing PECL extensions here: https://help.poralix.com/articles/installing-a-pecl-extension-for-php-on-directadmin-server
This time it is mcrypt. Let's go.
To be short here you can find a list of commands to run as root in a bash-console:
cd /usr/local/src rm -rf mcrypt-* /usr/local/php72/bin/pecl channel-update pecl.php.net /usr/local/php72/bin/pecl download mcrypt || /usr/local/php72/bin/pecl download channel://pecl.php.net/mcrypt-1.0.1 tar -zxvf mcrypt-*.tgz && cd mcrypt-*/ /usr/local/php72/bin/phpize ./configure --with-php-config=/usr/local/php72/bin/php-config make && make install echo "extension=mcrypt.so" >> /usr/local/php72/lib/php.conf.d/90-custom.ini
Restart PHP-FPM, Apache for changes to take effect.
Now test it:
/usr/local/php72/bin/php -i | grep ^mcrypt
You should see similar output:
mcrypt mcrypt support => enabled mcrypt_filter support => enabled mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value
That's it.