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
Posted in PHP

3 thoughts on “Install PHP mcrypt on Debian 10/PHP 7.3

  1. So I got a question. Im trying to make a owncloud raspberry pi server
    Im new to this so im not quite sure where you want to put the extension, is it under dynamic extensions or where?

    Also im guessing the semi colon before every extension there shouldnt be repeated for mcrypt?

    • The semi-colon that you may have guessed is to comment out the extensions. So even if you have two and they are both commented, shouldn’t matter. Just need to ensure that one of them is available. I hope that helped.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.