WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.2/mods-available

Reason: This module is not available for PHP 7.2 yet, you need to install the 7.1 version and link it to 7.2

Pointing to php7.1-mcrypt with php7.2 will solve the issue here. Below are the steps to configure 7.1 version mcrypt with php7.2

Install php7.1-mcrypt

sudo apt install php7.1-mcrypt

Create symbolic link to php7.1-mcrypt

sudo ln -s /etc/php/7.1/mods-available/mcrypt.ini /etc/php/7.2/mods-available/

Enable mcrypt extension

sudo phpenmod mcrypt

Thanks StackOverflow!

Alternative way

Installing mcrypt on PHP 7.2 or 7.3

To install this extension on PHP 7.2 or 7.3, run the following commands as your server’s root user:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libmcrypt-dev php-pear
sudo pecl install mcrypt

Once installed, create a configuration file for the extension and restart PHP by running the following commands as root:

sudo bash -c "echo extension=mcrypt.so > /etc/php7.2-sp/conf.d/mcrypt.ini"
sudo service php7.2-fpm-sp restart

Verifying mcrypt Is Installed

You can check that the extension was installed with this command:

php7.2-sp -i | grep mcrypt

The output will look like this:

$ php7.2-sp -i | grep mcrypt
Registered Stream Filters => zlib.*, convert.iconv.*, bzip2.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

Uninstalling the Mcrypt Extension

To uninstall this extension, as root run the commands:

sudo rm /etc/phpX.Y-sp/conf.d/mcrypt.ini
sudo peclX.Y-sp uninstall mcrypt

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
  • Category: PHP

2 Replies to “WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.2/mods-available”

  1. sudo aE: Couldn’t find any package by glob ‘php7.1-m

    I am getting the above error when i am trying to run the given command.crypt’pt install php7.1-mcrypt


    1. You can try the alternative way updated in the post


Leave a Reply

Your email address will not be published. Required fields are marked *

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