laravel 4: key not being generated with artisan

后端 未结 7 2152
温柔的废话
温柔的废话 2020-12-15 05:39

When running

php artisan key:generate

I can see the generated key in my shell, but the variable \'key\' in app.php remains empt

相关标签:
7条回答
  • 2020-12-15 06:19

    Have the same problem with L6 on Windows with xampp.

    1. Remove the cached config php artisan config:clear
    2. Regenerate key php artisan key:generate

    Hope it helps.

    0 讨论(0)
  • 2020-12-15 06:21

    I was having the same issue. From my project directory I noticed I had the .env file, when I opened the project in atom (my code editor) I noticed that file appeared as .env.txt, I removed the .txt part and ran the command. It worked for me.

    0 讨论(0)
  • 2020-12-15 06:24

    first type any 32 character like 'hyhyhGGyhyhyhyhy23hyhy23hyhy23hy' this and then re execute the command in terminal/cmd.

    Step 1:

    go to app ---> Config --> app.php

    step 2:

    'key' => '10101010101010101010101010101010', type any 32 digit or character in that place.

    step 3:

    go to terminal / cmd & type : "php artisan key:generate" press enter

    step 4:

    see the key has been changed :)

    [ It is because in Laravel 4 By using "php artisan key:generate" we simply can replace the default key any time. But if it is an empty space it can not be able to hold the place. ]

    Enjoy coding :) \m/

    0 讨论(0)
  • 2020-12-15 06:29

    Had the same problem ...

    1. Opened app.php
    2. Remove the entry that says 'YourSecretKey!!!'
    3. Ran 'php artisan key:generate'

    Showed me a key in the console, but nothing in app.php!

    Solution is ... unlike Laravel 3, don't delete the default YourSecretKey!!! in app.php, just run the command and it will work.

    Hope this helps.

    Bagwaa

    0 讨论(0)
  • 2020-12-15 06:34

    The key generator will only update the APP_KEY in the .env file.

    'key' => env('APP_KEY', 'YourSecretKey'), 
    

    config/app.php this is reading the APP_KEY from your .env file. The second parameter is a fallback.

    0 讨论(0)
  • 2020-12-15 06:37

    You should not remove the original key, just go to your project directory and run

    php artisan key:generate
    

    it will work if you don't touch the previous key.

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