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

后端 未结 14 1703
一个人的身影
一个人的身影 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.

提交回复
热议问题