一尘不染

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

php

我正在使用Laravel构建一个项目。在localhost上运行正常,但是当我将其上载到服务器(服务器已安装comodo ssl)时,出现以下错误:

RuntimeException in EncryptionServiceProvider.php line 29:
No supported encrypter found. The cipher and / or key length are invalid
in EncryptionServiceProvider.php line 29
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('encrypter', array()) in Application.php line 674
at Application->make('Illuminate\Contracts\Encryption\Encrypter') in Container.php line 837
at Container->resolveClass(object(ReflectionParameter)) in Container.php line 800
at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 771
at Container->build('SahraSalon\Http\Middleware\EncryptCookies', array()) in Container.php line 626
at Container->make('SahraSalon\Http\Middleware\EncryptCookies', array()) in Application.php line 674
at Application->make('SahraSalon\Http\Middleware\EncryptCookies') in Pipeline.php line 123
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
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 124
at Pipeline->Illuminate\Pipeline\{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 118
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 86
at Kernel->handle(object(Request)) in index.php line 54

谁能帮助解决此错误?


阅读 509

收藏
2020-05-29

共1个答案

一尘不染

服务器上是否已安装所有必需的扩展程序?

  • PHP> = 5.5.9
  • OpenSSL PHP扩展
  • PDO PHP扩展
  • Mbstring PHP扩展
  • Tokenizer PHP扩展

可能是您缺少OpenSSL扩展名。另外,您是否在.env文件中设置了密钥?


尝试运行:

php artisan key:generate


答:'cipher' => ''没有设置。

2020-05-29