Install mcrypt on Plesk PHP 7.4

Here is an easy-to-follow guide on how to install mcrypt for Plesk PHP 7.4 on Debian 9.
Some information before the guide:
Backup should be done before applying any steps here.
Any action you do on your server is on your own risk and will, I am not responsible for any issues.
This Guide was tested on: Plesk Obsidian 18.0.28.3 Debian 9.13 x86_64 Plesk PHP 7.4.8
Let’s start:
1. Login to the server over SSH onto the root user
2. Install the needed packages:
# apt install -y plesk-php74-dev gcc libmcrypt-dev
3. Install the module using PECL:
# /opt/plesk/php/7.4/bin/pecl install mcrypt
(press enter on the prompt: libmcrypt prefix? [autodetect] : )
4. Create an .ini configuration file for the module and add extension directive to enable the module:
# echo 'extension=mcrypt.so' > /opt/plesk/php/7.4/etc/php.d/mcrypt.ini
5. Reread the PHP handlers so that Plesk is aware of the changes:
# plesk bin php_handler --reread
6. Confirm that mcrypt is now enabled:
# /opt/plesk/php/7.4/bin/php -m | grep mcrypt
mcrypt
That’s it mcrypt is now installed on Plesk PHP 7.4.
Notes: – The module can be installed for other PHP versions the same way, just change in all commands the 7.4 with the version you need. – On Centos/RedHat based systems, the packages name change from dev to devel, so as an example plesk-php74-dev becomes plesk-php74-devel