Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

qxnxnx38n's avatar

The only supported ciphers are AES-128-CBC and AES-256-CBC

Hi all I just started to use Laravel and as the two last times it is really hard to get it running. Since yesterday I try to just get Laravel run without an error.

I installed Laravel with its installer and after the first errors I updated the project with composer update. But now I get the error message RuntimeException in Encrypter.php line 43: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

I do have my .env file and even if I clear the cache & config, re-genate the key the error still stays. I even tried to set and remove the 'key' => env() in the config/app.php file

Strangely with each key:generate the key is appended, not replaced. Wondering if this is normal

0 likes
6 replies
somnathsah's avatar

Try running below command which set APP_KEY, This might be not set, that's why you are getting this error

php artisan key:generate
qxnxnx38n's avatar

Well, I have done that and the key is in the .env Currently it looks like APP_KEY=base64:BIuT7FSqfWaFLlB+wGjz068pi02nO2lUQ2bbHAEn8AM=

somnathsah's avatar

I was also getting the same issue once, So I tried the below two commands that fixed my issue.

php artisan config:clear

php artisan key:generate

You can try running this command. I don't think there is any harm in running these commands.

There might be a chance that key may have became invalidated after composer update.

qxnxnx38n's avatar

As I said, I did also cleared the cache and the config and generated the key in almost every order and combination. Maybe something is missing on the server side?

somnathsah's avatar

You can also check in config\app.php file that cipher is set correctly like mine is.

'cipher' => 'AES-256-CBC'
qxnxnx38n's avatar

My config says the same 'cipher' => 'AES-256-CBC',

Please or to participate in this conversation.