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

Now this little number nearly had me committed! This is a very common error and I can point you to a slew of posts on the topic – this one here, though WAMP based is quite good: DeveloperSide.NET (accessed: 07/02/2016).

But hold on… before you rush off…

There is a gotcha to this solution and that is because in the config/app.php file the key is defined thus:

  'key' => env('hNlnyrwUPojqkh0Ux5Xb3jtPMbfGUfLc')

The reason for this is that it must be pulling in the key to test for a match but for some reason the comparison was not happening, So, the solution, albeit temporary (would not use this for production) until I can find out why 5.2 is spitting it out is to define the key like this:

  'key' => 'hNlnyrwUPojqkh0Ux5Xb3jtPMbfGUfLc'

On a side note a lot of solutions suggest using a 128 bit key instead of a 256 bit version. I would advise against this. Besides which it doesn’t make any difference but also its bad security. The longer the key the harder to crack.

After making the above change make sure you do the obligatory clearing of your cache:

  php artisan config:cache