php 7 Mcrypt PHP extension required

94,018

Solution 1

Had the same issue - PHP7 missing mcrypt.

This worked for me in Ubuntu Please try below commands.

sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade

Then restarts apache

sudo service apache2 restart

Hope this commands helps!

Solution 2

First Check whether the mcrypt PHP module is present:

$ php -m | grep mcrypt

To install the mcrypt PHP module we first need to satisfy the following prerequisites:

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

Now we are ready to install mcrypt PHP module on our Ubuntu 18.04 system:

$ sudo pecl channel-update pecl.php.net
$ sudo pecl install mcrypt-1.0.1

Open the /etc/php/7.2/cli/php.ini file and insert:

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

Then restarts apache

sudo service apache2 restart
Share:
94,018

Related videos on Youtube

Ali Bedaer
Author by

Ali Bedaer

Updated on July 09, 2022

Comments

  • Ali Bedaer
    Ali Bedaer almost 2 years

    hello guys l have installed php7 from this link and this link too.

    but when i try to run a Laravel based project there is an error coming up as follows

    Mcrypt PHP extension required.

    I tried to locate mcrypt.so and change the path in mycrpt.ini but i still get the same error i only get this error i Laravel projects

    • zaph
      zaph about 8 years
      It is best not to use mcrypt, it is abandonware, has not been updated in years and does not support standard PKCS#7 padding, only non-standard null padding that can't even be used with binary data. Instead consider using defuse, it is being maintained and is correct.
    • neubert
      neubert almost 5 years
      I'd recommend doing composer require phpseclib/mcrypt_compat. That'll install a pure-PHP mcrypt shim that'll eliminate the need for the mcrypt extension.
  • evilReiko
    evilReiko almost 7 years
    For anyone reading my comment, don't forget to restart apache
  • Michael Walter
    Michael Walter almost 7 years
    Could your maybe add in the answer that it is deprecated in 7.1.x and will be removed in 7.2.x? Source: php.net/manual/de/migration71.deprecated.php
  • PHP dev
    PHP dev about 6 years
    @Ankit Sompura please tell the solution for windows
  • jpalala
    jpalala about 4 years
    To update - some docs say that php mcrypt is no longer supported in around PHP7.2. On a debian server I had to specifty to Install php7.2-dev instead of php-dev (because if you install php-dev, it installs the latest php7.4-dev). Note to not install any other version of the php extensions other than 7.2 (prefixing everything with php7.2-). You can check what version your php-cli is using by typing php -v