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

后端 未结 14 1525
一个人的身影
一个人的身影 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:42

    If you newly create a laravel project with command like composer create-project --prefer-dist laravel/laravel market and deploy the new repo to the application path with cp command you may get this issue.

    I use laravel 5.4

    roofe@www:~/market$ php artisan --version
    Laravel Framework 5.4.33
    

    When you create the laravel project, you can see the the logs that create the key like this:

    Generating autoload files

    Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize Generating optimized class loader The compiled services file has been removed. php artisan key:generate Application key [base64:exxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/k=] set successfully.

    By default the key config in the config/app.php is as follows, it use AES-256-CBC and the generated key when creating the project is stored in the .env file. If you use command like cp -r ./* /var/www/market/ the .env file will not be moved to the application path.

    /*
    |--------------------------------------------------------------------------
    | Encryption Key
    |--------------------------------------------------------------------------
    |
    | This key is used by the Illuminate encrypter service and should be set
    | to a random, 32 character string, otherwise these encrypted strings
    | will not be safe. Please do this before deploying an application!
    |
    */
    
    'key' => env('APP_KEY'),
    
    'cipher' => 'AES-256-CBC',
    

    When I chage my deploy command to cp -r ./* ./.env /var/www/market/, this issue gone.

    You also can refer to this github issue.

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

    Check your .env file if APP_KEY is not set, it is the issue, Now run php artisan key:generate then run php artisan config:cache

    it will set an APP_KEY key in your .env file.

    If APP_KEY is already set run the same commands. It will update this key.

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

    Just remove APP_KEY value from .env file and run this commands again :

    php artisan key:generate
    php artisan config:cache
    

    Done.

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

    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 if you want to cache the configurtration Or php artisan config:clear

    Hopefully it will fix everything.

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

    For laravel version 5.4 PHP 7.4

    1. To solve run this command

    php artisan key:generate

    This will set a value for APP_KEY= in your .env file

    something like this: APP_KEY=base64:trp5LQ9/TW85+17o0T7F0bZ/Ca1J9cIMgvyNIYl0k/g=

    1. Clean cache to get everything working again with the following commands:

    php artisan config:clear

    then php artisan config:cache

    Hope this helps.

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

    Run php artisan key:generate.

    Do php artisan config:clear,

    Then php artisan config:cache

    And things will start working!

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