LAMP Laravel ErrorException mcrypt_get_iv_size(): 模块初始化失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23997121/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:35:34  来源:igfitidea点击:

LAMP Laravel ErrorException mcrypt_get_iv_size(): Module initialization failed

laravelmcrypt

提问by Daniel Wassano

I installed laravel in my new pc and i'm getting this error:

我在我的新电脑上安装了 laravel,但出现此错误:

ErrorException mcrypt_get_iv_size(): Module initialization failed

ErrorException mcrypt_get_iv_size(): 模块初始化失败

I copied the project from my old pc. mcrypt is installed and enabled, and other pages that do not use laravel are working. I'm running ubuntu 14.04

我从我的旧电脑上复制了这个项目。mcrypt 已安装并启用,其他不使用 Laravel 的页面正在运行。我正在运行 ubuntu 14.04

I created a new laravel project (using laravel new command) and when i try to access i get:

我创建了一个新的 laravel 项目(使用 laravel new 命令),当我尝试访问时,我得到:

"Whoops, looks like something went wrong."

“哎呀,看起来出事了。”

I opened the log and the error was:

我打开日志,错误是:

production.ERROR: exception 'ErrorException' with message 'mcrypt_get_iv_size(): Module initialization failed

production.ERROR: 异常 'ErrorException' 带有消息 'mcrypt_get_iv_size(): 模块初始化失败

any ideas?

有任何想法吗?

回答by RaySaraiva

On app/config/app.php just change: 'cipher' => MCRYPT_RIJNDAEL_256,

在 app/config/app.php 上只需更改:'cipher' => MCRYPT_RIJNDAEL_256,

回答by Laurence

Run php artisan key:generateon your command line to refresh your application key.

php artisan key:generate在命令行上运行以刷新应用程序密钥。

Then clear your cache and sessions and try again.

然后清除缓存和会话并重试。

I had this same problem today, and it was because of how Laravel 4.2 uses the new encryption method.

我今天遇到了同样的问题,这是因为 Laravel 4.2 如何使用新的加密方法。

回答by Dennis Schaffer

Make sure you run php 7.0, and add this string "MCRYPT_RIJNDAEL_256" (without the quotes) to the cipher in app.php. after generate a new key (php artisan key:generate) and add the new key. This works for me.

确保您运行 php 7.0,并将此字符串“MCRYPT_RIJNDAEL_256”(不带引号)添加到 app.php 中的密码中。生成新密钥后(php artisan key:generate)并添加新密钥。这对我有用。