php 7 Mcrypt PHP extension required

2019-02-06 14:47发布

问题:

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

回答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!



回答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