mcrypt extension is an interface to the mcrypt cryptography library. mcrypt is included in php5 to  php7.1 , but it’s removed from php7.2 . The instructions below help you install mcrypt for php7.2 on  Ubuntu.

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libgeoip-dev
pecl install --nodeps mcrypt-snapshot

when you are shown the prompt:

libmcrypt prefix? [autodetect] :

hit Enter

once installed , you need to create a configuration file for it

sudo bash -c "echo > /etc/php/7.2/conf.d/mcrypt.ini"