需要 php 7 Mcrypt PHP 扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36402000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php 7 Mcrypt PHP extension required
提问by Mekadoo
hello guys l have installed php7 from this linkand this linktoo.
but when i try to run a Laravel based project there is an error coming up as follows
但是当我尝试运行基于 Laravel 的项目时,出现如下错误
Mcrypt PHP extension required.
需要 Mcrypt PHP 扩展。
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
我试图找到 mcrypt.so 并更改 mycrpt.ini 中的路径,但我仍然遇到相同的错误我只在 Laravel 项目中遇到此错误
回答by Ankit Sompura
Had the same issue - PHP7 missing mcrypt.
有同样的问题 - PHP7 缺少 mcrypt。
This worked for me in Ubuntu Please try below commands.
这在 Ubuntu 中对我有用请尝试以下命令。
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade
Then restarts apache
然后重启apache
sudo service apache2 restart
Hope this commands helps!
希望这个命令有帮助!
回答by PHP Worm...
First Check whether the mcrypt PHP module is present:
首先检查mcrypt PHP模块是否存在:
$ php -m | grep mcrypt
To install the mcrypt PHP module we first need to satisfy the following prerequisites:
要安装 mcrypt PHP 模块,我们首先需要满足以下先决条件:
sudo apt install php-dev libmcrypt-dev php-pear
Now we are ready to install mcrypt PHP module on our Ubuntu 18.04 system:
现在我们准备在我们的 Ubuntu 18.04 系统上安装 mcrypt PHP 模块:
$ 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:
打开 /etc/php/7.2/cli/php.ini 文件并插入:
extension=mcrypt.so
All done. When successful, checking for the presence of the mcrypt PHP module should produce the following output:
全部完成。成功后,检查 mcrypt PHP 模块是否存在应该会产生以下输出:
$ php -m | grep mcrypt
mcrypt
Then restarts apache
然后重启apache
sudo service apache2 restart