找不到支持的加密器。 laravel的密码和/或密钥长度无效

时间:2017-02-23 06:46:50

标签: php laravel encryption

我的laravel安装有问题。错误消息(如下所示)不时发生(可能大约每100次点击一次)。

我做了php artisan key:generate命令。

我还检查了APP_KEY文件中的.env值:格式如base64:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

在我的config / app.php中,我有以下代码:'cipher' => 'AES-256-CBC'

我没有看到问题的来源......可能是因为两个变量之间的长度差异?但如果是这样的话,为什么它会随机发生呢?

RuntimeException in EncryptionServiceProvider.php line 45:
No supported encrypter found. The cipher and / or key length are invalid.
in EncryptionServiceProvider.php line 45
at EncryptionServiceProvider->getEncrypterForKeyAndCipher(null, 'AES-256-CBC') in EncryptionServiceProvider.php line 25
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array()) in Container.php line 731
at Container->build(object(Closure), array()) in Container.php line 629
at Container->make('encrypter', array()) in Application.php line 697
at Application->make('Illuminate\Contracts\Encryption\Encrypter') in Container.php line 849
at Container->resolveClass(object(ReflectionParameter)) in Container.php line 804
at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 775
at Container->build('Sparta\Http\Middleware\EncryptCookies', array()) in Container.php line 629
at Container->make('Sparta\Http\Middleware\EncryptCookies', array()) in Application.php line 697
at Application->make('Sparta\Http\Middleware\EncryptCookies') in Pipeline.php line 126
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
Whoops, looks like something went wrong.

2 个答案:

答案 0 :(得分:2)

.env 文件集APP_KEY=(没有值)并保存。 然后运行以下命令:

php artisan key:generate
php artisan config:cache

它对我有用。

答案 1 :(得分:0)

我设法通过在同一个按钮上连续多次点击以非常快的速度触发此消息,如果这可以帮助...