php 7 Mcrypt PHP extension required
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
Related videos on Youtube
![Ali Bedaer](https://lh4.googleusercontent.com/-CpWi2nVr_fQ/AAAAAAAAAAI/AAAAAAAAADY/VF9PXDitHuk/photo.jpg?sz=256)
Ali Bedaer
Updated on July 09, 2022Comments
-
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 about 8 yearsIt 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 almost 5 yearsI'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 almost 7 yearsFor anyone reading my comment, don't forget to restart apache
-
Michael Walter almost 7 yearsCould 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 about 6 years@Ankit Sompura please tell the solution for windows
-
jpalala about 4 yearsTo 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 withphp7.2-
). You can check what version your php-cli is using by typingphp -v