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

2019-01-08 18:00发布

I installed a new fresh copy of laravel 5.3 using composer but I keep getting this error:

The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. Even though my app.php file in config directory specify
'cipher' => 'AES-128-CBC',

10条回答
Bombasti
2楼-- · 2019-01-08 18:31

Run php artisan key:generate.

Do php artisan config:clear,

Then php artisan config:cache

And things will start working!

查看更多
smile是对你的礼貌
3楼-- · 2019-01-08 18:33

Follow These Steps:

Step 1: Make sure you have .env file in your application.If not run this command cp .env.example .env

Step 2: Now run following command ( php artisan key:generate ) to generate a key and it will get saved in .env file automatically.

Step 3: Run php artisan config:cache

It will fix everything.

查看更多
欢心
4楼-- · 2019-01-08 18:34

If the artisan command doesn't work and you get the same error in the command line, that means composer didn't do a good job at getting all the files, you should delete the vendor folder and run composer update again.

查看更多
看我几分像从前
5楼-- · 2019-01-08 18:38

Run this commands on your terminal:

php artisan config:clear
then
php artisan config:cache

查看更多
爱情/是我丢掉的垃圾
6楼-- · 2019-01-08 18:39

in .env file give this key and you are done

APP_KEY=ABCDEF123ERD456EABCDEF123ERD456E

Still not working?

If you are working from cli, reboot the server and it will.

Want explanation?

ok, as the error message says:

The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

Key length for AES-128-CBC is 16 characters e.g ABCDEF123ERD456E

Key length for AES-256-CBC is 32 characters e.g ABCDEF123ERD456EABCDEF123ERD456E

Make sure in config/app.php the cipher is set to the appropriate cipher like the two above and the key is pointing to the .env file APP_KEY variable. My app has the AES-256-CBC cipher set, so i gave it the 32 characters key like APP_KEY=ABCDEF123ERD456EABCDEF123ERD456E and everything worked just fine after that.

查看更多
Emotional °昔
7楼-- · 2019-01-08 18:42

Ok, this has basically already been answered, but I found a couple caveats that had be consternated, or constipated, one of those two...

First, as has already been said, you should ensure you have a valid .env file which you can accomplish in the terminal by copying the existing .env.example file as such:

$ cp .env.example .env

Then, generate your application Key

$ php artisan key:generate

Once this is done, make sure to open your .env file and ensure that the APP_KEY line looks correct - this is where my consternation came from:

APP_KEY=base64:MsUJo+qAhIVGPx52r1mbxCYn5YbWtCx8FQ7pTaHEvRo=base64:Ign7MpdXw4FMI5ai7SXXiU2vbraqhyEK1NniKPNJKGY=

You'll notice that the key length is wrong, it for some unknown reason (probably from running key:generate multiple times) has two base64= keys in there. Removing one is the fix to the problems I was having and this appears to be an Artisan/Laravel bug.

Hope this answer helps anyone who may be struggling with the same problems or annoying bug.

查看更多
登录 后发表回答