Mcrypt is deprecated since PHP 7.1 and completely removed from PHP since version 7.2. You should use OpenSSL or Sodium.
But sometimes you’re stuck on using mcrypt because of old software or scripts, then it’s a good thing you can still install mcrypt on your cPanel server.
First, you need to install the mcrypt lib on the server:
yum install libmcrypt libmcrypt-devel
Then we need to install mcrypt for the required PHP versions. That can be done by using pecl:
ea-php7X-pecl install mcrypt-1.0.4
Replace `php7X` with your version, for example `php74` for PHP 7.4.
ea-php72-pecl install mcrypt-1.0.4
ea-php73-pecl install mcrypt-1.0.4
ea-php74-pecl install mcrypt-1.0.4
The installer might ask you for a libmcrypt prefix. Just hit enter as the installer usually finds the lib itself. If that’s not the case for you, provide:
/opt/cpanel/libmcrypt/
At last, a small tip: try to remove mcrypt from you software/scripts, as you need to do this for every PHP version in the future.