Please note that higher releases of PHP ( PHP 7.1 or PHP 7.2 + ) do not support this module anymore. This has been eliminated. We need to use the php 7 if you want to use this module inside your project, follow the below steps after switching back to php 7,
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade
echo “extension=mcrypt.so” | sudo tee -a /etc/php/7.0/apache2/conf.d/mcrypt.ini
Then restarts apache
sudo service apache2 restart