Thursday, September 3, 2015

Laravel 5 - No supported encrypter found. The cipher and / or key length are invalid

Hey, I got an error msg said my laravel 5 installation went wrong :
RuntimeException in compiled.php line 6779:
No supported encrypter found. The cipher and / or key length are invalid.
in compiled.php line 6779
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array()) in compiled.php line 1086
at Container->build(object(Closure), array()) in compiled.php line 1039
at Container->make('encrypter', array()) in compiled.php line 1577
at Application->make('Illuminate\Contracts\Encryption\Encrypter') in compiled.php line 1131
at Container->resolveClass(object(ReflectionParameter)) in compiled.php line 1115
at Container->getDependencies(array(object(ReflectionParameter)), array()) in compiled.php line 1101
at Container->build('App\Http\Middleware\EncryptCookies', array()) in compiled.php line 1039
at Container->make('App\Http\Middleware\EncryptCookies', array()) in compiled.php line 1577
at Application->make('App\Http\Middleware\EncryptCookies') in compiled.php line 9274
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2776
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9274
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9264
at Pipeline->then(object(Closure)) in compiled.php line 2053
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2036
at Kernel->handle(object(Request)) in index.php line 54

We need to create a random of 32 char string as application key. Just run the command and get the access key:
$ php artisan key:generate

Copy that generated key and put it inside /config/app.php file, for example :
'key' => env('APP_KEY', 'ql9xRk2DuYTdl8QJrmjmRCfRx3kyCZC2'),

Dont forget to give write permission for /storage directory (chmod -R 755 are enough for that).

No comments:

Post a Comment