Install PHP mcrypt on Debian 10/PHP 7.3

Here are instructions to install and run mcrypt on Debian 10 with PHP 7.3+

Check PHP Version

$ php -version
PHP 7.3.9-1~deb10u1 (cli) (built: Sep 18 2019 10:33:23) ( NTS )

Check if mcrypt is installed

$ php -m | grep mcrypt

Install pre-requisites

sudo apt-get install php-dev libmcrypt-dev php-pear

Install mcrypt PHP module

$ sudo pecl channel-update pecl.php.net
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded

$ sudo pecl install channel://pecl.php.net/mcrypt-1.0.2
...
...
Build process completed successfully
Installing '/usr/lib/php/20180731/mcrypt.so'
install ok: channel://pecl.php.net/mcrypt-1.0.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=mcrypt.so" to php.ini

Add mcrypt.so to the php.ini file

Open the /etc/php/7.3/cli/php.ini file and insert the following at the appropriate place where other extensions are added:

extension=mcrypt.so

All done. When successful, checking for the presence of the mcrypt PHP module should produce the following output:

$ php -m | grep mcrypt
mcrypt

Mastering automation, improving efficiency and connecting systems.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store