Laravel :“mcrypt_decrypt():IV 参数必须与块大小一样长”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23922523/
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
Laravel : "mcrypt_decrypt(): The IV parameter must be as long as the blocksize"
提问by Kousha
I ran composer update
on a Laravel application, and now I am getting this error:
我composer update
在 Laravel 应用程序上运行,现在出现此错误:
mcrypt_decrypt(): The IV parameter must be as long as the blocksize
mcrypt_decrypt():IV参数必须和blocksize一样长
What happened?!
发生了什么?!
回答by Kousha
I figured this out. All you have to do is clear your cookies, and everything will be A-okay!
我想通了这一点。您所要做的就是清除您的 cookie,一切都会好起来的!
回答by user2432443
You need to change your cipher at app\config\app.php. Having same cipher name was causing that problem for me. I changed the cipher name uniquely & then it worked fine.
您需要在 app\config\app.php 中更改密码。具有相同的密码名称给我造成了这个问题。我唯一地更改了密码名称,然后它工作正常。
回答by Ifan Iqbal
This problem can also happen when you run more than one Laravel project/app with same Encryption Key. Just change key
value in app/config/app.php
with different value and you ready to go.
当您使用相同的加密密钥运行多个 Laravel 项目/应用程序时,也会发生此问题。只需将key
值更改app/config/app.php
为不同的值,您就可以开始使用了。
回答by Volzy
Just elaborating on the answer from Ifan Iqbal. As he says this happens when running several Laravel installations with the same encryption key. Instead of clearing your cookies, simply create a unique key for each Laravel install you run (good practice by the way).
只是详细说明 Ifan Iqbal 的答案。正如他所说,当使用相同的加密密钥运行多个 Laravel 安装时会发生这种情况。无需清除 cookie,只需为您运行的每个 Laravel 安装创建一个唯一的密钥(顺便说一句,这是个好习惯)。
Go to your terminal and put:
转到您的终端并输入:
php artisan key:generate
This will automatically set the encryption key in app/config/app.php and your error will go away.
这将自动在 app/config/app.php 中设置加密密钥,您的错误将消失。