How to install and enable mcrypt

To install mcrypt in Ubuntu/Debian, run the following command:

sudo apt-get install php-mcrypt

In CentOS like this:

sudo yum install php-mcrypt

After that, the mcrypt.ini file will appear in the PHP directory with the extension, in my case it appeared /etc/php/7.0/mods-available/mcrypt.ini.

You can activate/deactivate the module like this:

sudo phpenmod mcrypt
sudo phpdismod mcrypt

Restart Apache2 to apply the changes:

sudo service apache2 restart

Let’s see if mcrypt is activated:

php -i | grep -i mcrypt

Leave a Reply