Zend certified PHP/Magento developer

Problem with installing mcrypt on PHP 7.3.13 Ubuntu

I have moved my magento 2 project from one vps server to another. So im currently setting up all the PHP modules. But there seem to be some problem with the mcrypt module.

This is what I have been doing.

$ sudo apt-get -y install gcc make autoconf libc-dev pkg-config
$ sudo apt-get -y install libmcrypt-de
$ sudo pecl install mcrypt-1.0.2
> libmcrypt prefix? [autodetect] :

Im adding “extension=mcrypt.so” to php.ini

Then I do

sudo bash -c "echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.2/cli/conf.d/mcrypt.ini"
sudo bash -c "echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.2/apache2/conf.d/mcrypt.ini"

I followed these instruction: https://lukasmestan.com/install-mcrypt-extension-in-php7-2/

But when I check with php -i | grep mcrypt

I get this is my output:

P

HP Warning:  PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20180731
These options need to match
 in Unknown on line 0
/etc/php/7.3/cli/conf.d/20-mcrypt.ini,
/etc/php/7.3/cli/conf.d/mcrypt.ini

I have checked both 20-mcrypt.ini and mcrypt.ini and they look exaclty the same. But my PHP seems to be compiled with the wrong module API. I google around but couldn’t find anything specific on that. Any idéas? Thanks!

What I have been using