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

后端 未结 14 1523
一个人的身影
一个人的身影 2020-12-01 01:09

I installed a new fresh copy of Laravel 5.3 using composer but I\'m getting this error:

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

相关标签:
14条回答
  • 2020-12-01 01:32

    I also had this issue. I check my environment variable value for "APP_KEY" using echo $APP_KEY For me it was "lumen" which was set for another lumen project and that's why it was not working.

    I updated "APP_KEY" value using export APP_KEY=[you app_key value from .env file] and cleared cache php artisan config:cache and it worked for me.

    0 讨论(0)
  • 2020-12-01 01:35

    Run this commands on your terminal:

    php artisan config:clear
    then
    php artisan config:cache

    0 讨论(0)
  • 2020-12-01 01:36

    You need to have .env on your appication folder then run:

    $ php artisan key:generate
    

    If you don't have .env copy from .env.example:

    $ cp .env.example .env
    
    0 讨论(0)
  • 2020-12-01 01:37

    Another thing to just check is that your .env file is in the www-data group (or httpd or whatever your web server group is) and that the group has read permission.

    On linux my permissions looked like this when I got this error: -rw-rw-r-- 1 kevin kevin 618 Mar 16 09:32 .env I then just removed read permission for all and removed write permission for group. chmod 640 .env Then I changed the group to www-data chown kevin:www-data .env My permissions now look like this: -rw-r----- 1 kevin www-data 516 Mar 16 09:35 .env

    0 讨论(0)
  • 2020-12-01 01:40

    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.

    0 讨论(0)
  • 2020-12-01 01:42

    If you are running a Laravel project for the first time in that machine make sure you have the necessary requirements. Open your CMD/Terminal in your project directory or

    cd to/your/project/dir
    

    Give this command again:

    composer update
    

    Change your .env.example to .env and make necessary changes in that file especially database configurations to avoid db error. Then

    php artisan key:generate
    

    This solves this AES cipher key length problem every time I create a Laravel project or clone it from git.

    0 讨论(0)
提交回复
热议问题