No Application Encryption Key Has Been Specified












135















I'm new to Laravel and I'm trying to use the Artisan command...



php artisan serve


It displays...




Laravel development server started: http://127.0.0.1:8000




However, it won't automatically launch and when I manually enter http://127.0.0.1:8000 it shows this error:




RuntimeException No application encryption key has been specified.




Any ideas? I'm using Laravel framework 5.5-dev.










share|improve this question

























  • or if your .env file needs to be changed ref: stackoverflow.com/questions/36276767/…

    – Nameishi
    Aug 12 '17 at 23:20






  • 2





    The answers below are correct: however, if you first run "php artisan serve" and have an active web server session you will need to restart the server (control-c in the terminal to stop) to get the change to take effect after you add the key to your .env file.

    – Chris Adams
    Oct 24 '17 at 19:51
















135















I'm new to Laravel and I'm trying to use the Artisan command...



php artisan serve


It displays...




Laravel development server started: http://127.0.0.1:8000




However, it won't automatically launch and when I manually enter http://127.0.0.1:8000 it shows this error:




RuntimeException No application encryption key has been specified.




Any ideas? I'm using Laravel framework 5.5-dev.










share|improve this question

























  • or if your .env file needs to be changed ref: stackoverflow.com/questions/36276767/…

    – Nameishi
    Aug 12 '17 at 23:20






  • 2





    The answers below are correct: however, if you first run "php artisan serve" and have an active web server session you will need to restart the server (control-c in the terminal to stop) to get the change to take effect after you add the key to your .env file.

    – Chris Adams
    Oct 24 '17 at 19:51














135












135








135


26






I'm new to Laravel and I'm trying to use the Artisan command...



php artisan serve


It displays...




Laravel development server started: http://127.0.0.1:8000




However, it won't automatically launch and when I manually enter http://127.0.0.1:8000 it shows this error:




RuntimeException No application encryption key has been specified.




Any ideas? I'm using Laravel framework 5.5-dev.










share|improve this question
















I'm new to Laravel and I'm trying to use the Artisan command...



php artisan serve


It displays...




Laravel development server started: http://127.0.0.1:8000




However, it won't automatically launch and when I manually enter http://127.0.0.1:8000 it shows this error:




RuntimeException No application encryption key has been specified.




Any ideas? I'm using Laravel framework 5.5-dev.







php laravel laravel-5 laravel-5.5 artisan






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 5:49









Karl Hill

2,55412042




2,55412042










asked Jun 30 '17 at 6:06









Carlos FCarlos F

9322715




9322715













  • or if your .env file needs to be changed ref: stackoverflow.com/questions/36276767/…

    – Nameishi
    Aug 12 '17 at 23:20






  • 2





    The answers below are correct: however, if you first run "php artisan serve" and have an active web server session you will need to restart the server (control-c in the terminal to stop) to get the change to take effect after you add the key to your .env file.

    – Chris Adams
    Oct 24 '17 at 19:51



















  • or if your .env file needs to be changed ref: stackoverflow.com/questions/36276767/…

    – Nameishi
    Aug 12 '17 at 23:20






  • 2





    The answers below are correct: however, if you first run "php artisan serve" and have an active web server session you will need to restart the server (control-c in the terminal to stop) to get the change to take effect after you add the key to your .env file.

    – Chris Adams
    Oct 24 '17 at 19:51

















or if your .env file needs to be changed ref: stackoverflow.com/questions/36276767/…

– Nameishi
Aug 12 '17 at 23:20





or if your .env file needs to be changed ref: stackoverflow.com/questions/36276767/…

– Nameishi
Aug 12 '17 at 23:20




2




2





The answers below are correct: however, if you first run "php artisan serve" and have an active web server session you will need to restart the server (control-c in the terminal to stop) to get the change to take effect after you add the key to your .env file.

– Chris Adams
Oct 24 '17 at 19:51





The answers below are correct: however, if you first run "php artisan serve" and have an active web server session you will need to restart the server (control-c in the terminal to stop) to get the change to take effect after you add the key to your .env file.

– Chris Adams
Oct 24 '17 at 19:51












11 Answers
11






active

oldest

votes


















234














From Encryption - Laravel - The PHP Framework For Web Artisans:




"Before using Laravel's encrypter, you must set a key option in your
config/app.php configuration file. You should use the
php artisan key:generate command to generate this key"




I found that using this complex internet query in google.com:



"laravel add encrption key" (Yes, it worked even with the typo!)






share|improve this answer





















  • 17





    I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

    – Carlos F
    Jun 30 '17 at 6:11











  • Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

    – Nameishi
    Aug 12 '17 at 22:57






  • 1





    For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

    – Nameishi
    Aug 12 '17 at 23:15






  • 4





    php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

    – Oniya Daniel
    Nov 4 '17 at 8:39








  • 4





    This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

    – Webomatik
    Nov 27 '17 at 15:11



















52














In my case, I also needed to reset the cached config files:



php artisan key:generate
php artisan config:cache





share|improve this answer



















  • 2





    I always come to see this answer after I forget to clear the cache

    – vijayrana
    Aug 21 '18 at 16:40






  • 1





    This was missing from all the answers. Thanks so very much! :)

    – Aman Alam
    Aug 28 '18 at 8:52



















44














Run the command php artisan key:generate it will generate Application Key for your application. You can find the application key(APP_KEY) in .env file.






share|improve this answer


























  • I think you should update the answer . The file name is .env .

    – Madhab452
    Dec 12 '17 at 7:23













  • @Madhab452 thanks, I did fix it.

    – skm
    Dec 12 '17 at 11:31



















16














simply run php artisan key:generate






share|improve this answer



















  • 1





    Yes but many hosting server do not have command line access then how to do?

    – Dhiraj
    Nov 13 '17 at 8:50






  • 1





    a majority support ssh connection. from your terminal run ssh yourusername@server_ip

    – D J
    Oct 17 '18 at 12:29



















14














I actually had to add a .env file to my project and then copy the contents of .env.example so that the key:generate would work. Not sure why a .env file was not created when I started the project.






share|improve this answer





















  • 1





    It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

    – Sᴀᴍ Onᴇᴌᴀ
    Sep 11 '17 at 16:01













  • also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

    – Sami El Maameri
    Jun 17 '18 at 6:08











  • I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

    – Timothy Kruger
    Jun 18 '18 at 7:49



















13
















  1. Copy .env.example to .env:



    cp -a .env.example .env




  2. Generate a key:



    php artisan key:generate




  3. Only then run:



    php artisan serve








share|improve this answer

































    12














    cp .env.example .env if there is no .env file present.
    php artisan key:generate command works for me. It generates the encryption key






    share|improve this answer


























    • clear the cache using php artisan config:cache command after the above steps.

      – Sabyasachi Ghosh
      Jan 14 at 10:08



















    10














    php artisan key:generate
    php artisan config:cache


    worked for me, but it had to be done in a command prompt on Windows.



    Doing it inside the terminal in PHPStorm didn't worked.






    share|improve this answer































      7














      A common issue you might experience when working on a Laravel application is the exception:




      RuntimeException No application encryption key has been specified.




      You'll often run into this when you pull down an existing Laravel application, where you copy the .env.example file to .env but don't set a value for the APP_KEY variable.



      At the command line, issue the following Artisan command to generate a key:



      php artisan key:generate


      This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache



      Also, you have to restart the server now you will not get to see this error message.






      share|improve this answer

































        4














        Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:




        1. Rename or copy/rename .env.example file in the root of your project to .env.



        You should not just create empty .env file, but fill it with
        content of .env.example.





        1. In the terminal go to the project root directory(not public folder) and run



        php artisan key:generate





        1. If everything is okay, the response in the terminal should look like this



        Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=]
        set successfully.





        1. Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:



        APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=





        1. In terminal run



        php artisan config:cache




        That's it.






        share|improve this answer


























        • So php artisan key:generate didn't automatically add the key to your .env file?

          – Ross Wilson
          Jul 25 '18 at 12:39











        • No, in my case.

          – Dmitry Gordienko
          Jul 25 '18 at 12:48





















        3














        You can generate Application Encryption Key using this command:



        php artisan key:generate


        Then, create a cache file for faster configuration loading using this command:



        php artisan config:cache


        Or, serve the application on the PHP development server using this command:



        php artisan serve


        That's it!






        share|improve this answer

































          11 Answers
          11






          active

          oldest

          votes








          11 Answers
          11






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          234














          From Encryption - Laravel - The PHP Framework For Web Artisans:




          "Before using Laravel's encrypter, you must set a key option in your
          config/app.php configuration file. You should use the
          php artisan key:generate command to generate this key"




          I found that using this complex internet query in google.com:



          "laravel add encrption key" (Yes, it worked even with the typo!)






          share|improve this answer





















          • 17





            I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

            – Carlos F
            Jun 30 '17 at 6:11











          • Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

            – Nameishi
            Aug 12 '17 at 22:57






          • 1





            For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

            – Nameishi
            Aug 12 '17 at 23:15






          • 4





            php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

            – Oniya Daniel
            Nov 4 '17 at 8:39








          • 4





            This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

            – Webomatik
            Nov 27 '17 at 15:11
















          234














          From Encryption - Laravel - The PHP Framework For Web Artisans:




          "Before using Laravel's encrypter, you must set a key option in your
          config/app.php configuration file. You should use the
          php artisan key:generate command to generate this key"




          I found that using this complex internet query in google.com:



          "laravel add encrption key" (Yes, it worked even with the typo!)






          share|improve this answer





















          • 17





            I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

            – Carlos F
            Jun 30 '17 at 6:11











          • Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

            – Nameishi
            Aug 12 '17 at 22:57






          • 1





            For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

            – Nameishi
            Aug 12 '17 at 23:15






          • 4





            php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

            – Oniya Daniel
            Nov 4 '17 at 8:39








          • 4





            This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

            – Webomatik
            Nov 27 '17 at 15:11














          234












          234








          234







          From Encryption - Laravel - The PHP Framework For Web Artisans:




          "Before using Laravel's encrypter, you must set a key option in your
          config/app.php configuration file. You should use the
          php artisan key:generate command to generate this key"




          I found that using this complex internet query in google.com:



          "laravel add encrption key" (Yes, it worked even with the typo!)






          share|improve this answer















          From Encryption - Laravel - The PHP Framework For Web Artisans:




          "Before using Laravel's encrypter, you must set a key option in your
          config/app.php configuration file. You should use the
          php artisan key:generate command to generate this key"




          I found that using this complex internet query in google.com:



          "laravel add encrption key" (Yes, it worked even with the typo!)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 9 '18 at 8:17

























          answered Jun 30 '17 at 6:08









          AmarnasanAmarnasan

          7,70832032




          7,70832032








          • 17





            I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

            – Carlos F
            Jun 30 '17 at 6:11











          • Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

            – Nameishi
            Aug 12 '17 at 22:57






          • 1





            For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

            – Nameishi
            Aug 12 '17 at 23:15






          • 4





            php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

            – Oniya Daniel
            Nov 4 '17 at 8:39








          • 4





            This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

            – Webomatik
            Nov 27 '17 at 15:11














          • 17





            I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

            – Carlos F
            Jun 30 '17 at 6:11











          • Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

            – Nameishi
            Aug 12 '17 at 22:57






          • 1





            For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

            – Nameishi
            Aug 12 '17 at 23:15






          • 4





            php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

            – Oniya Daniel
            Nov 4 '17 at 8:39








          • 4





            This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

            – Webomatik
            Nov 27 '17 at 15:11








          17




          17





          I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

          – Carlos F
          Jun 30 '17 at 6:11





          I googled the whole error and nothing apeared, just googled set encriptyon key and found out. Feel like a fool. Thanks. For anyone who arrives here just run: php artisan key:generate

          – Carlos F
          Jun 30 '17 at 6:11













          Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

          – Nameishi
          Aug 12 '17 at 22:57





          Im sorry so are you putting php artisan key:generate in the terminal? because I get an ErrorException

          – Nameishi
          Aug 12 '17 at 22:57




          1




          1





          For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

          – Nameishi
          Aug 12 '17 at 23:15





          For anyone else that ran into my issue input this into the terminal cp .env.example .env php artisan key:generate

          – Nameishi
          Aug 12 '17 at 23:15




          4




          4





          php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

          – Oniya Daniel
          Nov 4 '17 at 8:39







          php artisan key:generate does not even work for me. Gives me the same error No application encryption key has been specified, please any solution?

          – Oniya Daniel
          Nov 4 '17 at 8:39






          4




          4





          This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

          – Webomatik
          Nov 27 '17 at 15:11





          This worked for me, but I first had to rename the file .env.example to .env for this to work, otherwise I was getting ".env: no such file" error.

          – Webomatik
          Nov 27 '17 at 15:11













          52














          In my case, I also needed to reset the cached config files:



          php artisan key:generate
          php artisan config:cache





          share|improve this answer



















          • 2





            I always come to see this answer after I forget to clear the cache

            – vijayrana
            Aug 21 '18 at 16:40






          • 1





            This was missing from all the answers. Thanks so very much! :)

            – Aman Alam
            Aug 28 '18 at 8:52
















          52














          In my case, I also needed to reset the cached config files:



          php artisan key:generate
          php artisan config:cache





          share|improve this answer



















          • 2





            I always come to see this answer after I forget to clear the cache

            – vijayrana
            Aug 21 '18 at 16:40






          • 1





            This was missing from all the answers. Thanks so very much! :)

            – Aman Alam
            Aug 28 '18 at 8:52














          52












          52








          52







          In my case, I also needed to reset the cached config files:



          php artisan key:generate
          php artisan config:cache





          share|improve this answer













          In my case, I also needed to reset the cached config files:



          php artisan key:generate
          php artisan config:cache






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 17 '18 at 14:20









          Leonid DashkoLeonid Dashko

          746611




          746611








          • 2





            I always come to see this answer after I forget to clear the cache

            – vijayrana
            Aug 21 '18 at 16:40






          • 1





            This was missing from all the answers. Thanks so very much! :)

            – Aman Alam
            Aug 28 '18 at 8:52














          • 2





            I always come to see this answer after I forget to clear the cache

            – vijayrana
            Aug 21 '18 at 16:40






          • 1





            This was missing from all the answers. Thanks so very much! :)

            – Aman Alam
            Aug 28 '18 at 8:52








          2




          2





          I always come to see this answer after I forget to clear the cache

          – vijayrana
          Aug 21 '18 at 16:40





          I always come to see this answer after I forget to clear the cache

          – vijayrana
          Aug 21 '18 at 16:40




          1




          1





          This was missing from all the answers. Thanks so very much! :)

          – Aman Alam
          Aug 28 '18 at 8:52





          This was missing from all the answers. Thanks so very much! :)

          – Aman Alam
          Aug 28 '18 at 8:52











          44














          Run the command php artisan key:generate it will generate Application Key for your application. You can find the application key(APP_KEY) in .env file.






          share|improve this answer


























          • I think you should update the answer . The file name is .env .

            – Madhab452
            Dec 12 '17 at 7:23













          • @Madhab452 thanks, I did fix it.

            – skm
            Dec 12 '17 at 11:31
















          44














          Run the command php artisan key:generate it will generate Application Key for your application. You can find the application key(APP_KEY) in .env file.






          share|improve this answer


























          • I think you should update the answer . The file name is .env .

            – Madhab452
            Dec 12 '17 at 7:23













          • @Madhab452 thanks, I did fix it.

            – skm
            Dec 12 '17 at 11:31














          44












          44








          44







          Run the command php artisan key:generate it will generate Application Key for your application. You can find the application key(APP_KEY) in .env file.






          share|improve this answer















          Run the command php artisan key:generate it will generate Application Key for your application. You can find the application key(APP_KEY) in .env file.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 12 '17 at 11:30

























          answered Jun 30 '17 at 6:15









          skmskm

          810622




          810622













          • I think you should update the answer . The file name is .env .

            – Madhab452
            Dec 12 '17 at 7:23













          • @Madhab452 thanks, I did fix it.

            – skm
            Dec 12 '17 at 11:31



















          • I think you should update the answer . The file name is .env .

            – Madhab452
            Dec 12 '17 at 7:23













          • @Madhab452 thanks, I did fix it.

            – skm
            Dec 12 '17 at 11:31

















          I think you should update the answer . The file name is .env .

          – Madhab452
          Dec 12 '17 at 7:23







          I think you should update the answer . The file name is .env .

          – Madhab452
          Dec 12 '17 at 7:23















          @Madhab452 thanks, I did fix it.

          – skm
          Dec 12 '17 at 11:31





          @Madhab452 thanks, I did fix it.

          – skm
          Dec 12 '17 at 11:31











          16














          simply run php artisan key:generate






          share|improve this answer



















          • 1





            Yes but many hosting server do not have command line access then how to do?

            – Dhiraj
            Nov 13 '17 at 8:50






          • 1





            a majority support ssh connection. from your terminal run ssh yourusername@server_ip

            – D J
            Oct 17 '18 at 12:29
















          16














          simply run php artisan key:generate






          share|improve this answer



















          • 1





            Yes but many hosting server do not have command line access then how to do?

            – Dhiraj
            Nov 13 '17 at 8:50






          • 1





            a majority support ssh connection. from your terminal run ssh yourusername@server_ip

            – D J
            Oct 17 '18 at 12:29














          16












          16








          16







          simply run php artisan key:generate






          share|improve this answer













          simply run php artisan key:generate







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 12 '17 at 6:18









          D JD J

          18414




          18414








          • 1





            Yes but many hosting server do not have command line access then how to do?

            – Dhiraj
            Nov 13 '17 at 8:50






          • 1





            a majority support ssh connection. from your terminal run ssh yourusername@server_ip

            – D J
            Oct 17 '18 at 12:29














          • 1





            Yes but many hosting server do not have command line access then how to do?

            – Dhiraj
            Nov 13 '17 at 8:50






          • 1





            a majority support ssh connection. from your terminal run ssh yourusername@server_ip

            – D J
            Oct 17 '18 at 12:29








          1




          1





          Yes but many hosting server do not have command line access then how to do?

          – Dhiraj
          Nov 13 '17 at 8:50





          Yes but many hosting server do not have command line access then how to do?

          – Dhiraj
          Nov 13 '17 at 8:50




          1




          1





          a majority support ssh connection. from your terminal run ssh yourusername@server_ip

          – D J
          Oct 17 '18 at 12:29





          a majority support ssh connection. from your terminal run ssh yourusername@server_ip

          – D J
          Oct 17 '18 at 12:29











          14














          I actually had to add a .env file to my project and then copy the contents of .env.example so that the key:generate would work. Not sure why a .env file was not created when I started the project.






          share|improve this answer





















          • 1





            It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

            – Sᴀᴍ Onᴇᴌᴀ
            Sep 11 '17 at 16:01













          • also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

            – Sami El Maameri
            Jun 17 '18 at 6:08











          • I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

            – Timothy Kruger
            Jun 18 '18 at 7:49
















          14














          I actually had to add a .env file to my project and then copy the contents of .env.example so that the key:generate would work. Not sure why a .env file was not created when I started the project.






          share|improve this answer





















          • 1





            It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

            – Sᴀᴍ Onᴇᴌᴀ
            Sep 11 '17 at 16:01













          • also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

            – Sami El Maameri
            Jun 17 '18 at 6:08











          • I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

            – Timothy Kruger
            Jun 18 '18 at 7:49














          14












          14








          14







          I actually had to add a .env file to my project and then copy the contents of .env.example so that the key:generate would work. Not sure why a .env file was not created when I started the project.






          share|improve this answer















          I actually had to add a .env file to my project and then copy the contents of .env.example so that the key:generate would work. Not sure why a .env file was not created when I started the project.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 11 '17 at 15:57









          Sᴀᴍ Onᴇᴌᴀ

          6,56182142




          6,56182142










          answered Sep 11 '17 at 15:35









          Craig KollrossCraig Kollross

          14112




          14112








          • 1





            It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

            – Sᴀᴍ Onᴇᴌᴀ
            Sep 11 '17 at 16:01













          • also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

            – Sami El Maameri
            Jun 17 '18 at 6:08











          • I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

            – Timothy Kruger
            Jun 18 '18 at 7:49














          • 1





            It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

            – Sᴀᴍ Onᴇᴌᴀ
            Sep 11 '17 at 16:01













          • also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

            – Sami El Maameri
            Jun 17 '18 at 6:08











          • I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

            – Timothy Kruger
            Jun 18 '18 at 7:49








          1




          1





          It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

          – Sᴀᴍ Onᴇᴌᴀ
          Sep 11 '17 at 16:01







          It might depend on how you installed Laravel ... "In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually." -#Environment Configuration

          – Sᴀᴍ Onᴇᴌᴀ
          Sep 11 '17 at 16:01















          also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

          – Sami El Maameri
          Jun 17 '18 at 6:08





          also, if you cloned the project from a repo where the .env file was likely in .gitignore, then you would neeed to create it as well. From the Laravel docs: 'Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration'

          – Sami El Maameri
          Jun 17 '18 at 6:08













          I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

          – Timothy Kruger
          Jun 18 '18 at 7:49





          I also found that if you download it from the cloud (I'm using windows) i.e. google-drive, sky-drive etc. the .env, .env.example files are named _env, _env.example etc. In that case I renamed the files accordingly and then just ran 'php artisan key:generate'.

          – Timothy Kruger
          Jun 18 '18 at 7:49











          13
















          1. Copy .env.example to .env:



            cp -a .env.example .env




          2. Generate a key:



            php artisan key:generate




          3. Only then run:



            php artisan serve








          share|improve this answer






























            13
















            1. Copy .env.example to .env:



              cp -a .env.example .env




            2. Generate a key:



              php artisan key:generate




            3. Only then run:



              php artisan serve








            share|improve this answer




























              13












              13








              13









              1. Copy .env.example to .env:



                cp -a .env.example .env




              2. Generate a key:



                php artisan key:generate




              3. Only then run:



                php artisan serve








              share|improve this answer

















              1. Copy .env.example to .env:



                cp -a .env.example .env




              2. Generate a key:



                php artisan key:generate




              3. Only then run:



                php artisan serve









              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jan 10 '18 at 8:48

























              answered Jan 10 '18 at 8:14









              Adam PeryAdam Pery

              419412




              419412























                  12














                  cp .env.example .env if there is no .env file present.
                  php artisan key:generate command works for me. It generates the encryption key






                  share|improve this answer


























                  • clear the cache using php artisan config:cache command after the above steps.

                    – Sabyasachi Ghosh
                    Jan 14 at 10:08
















                  12














                  cp .env.example .env if there is no .env file present.
                  php artisan key:generate command works for me. It generates the encryption key






                  share|improve this answer


























                  • clear the cache using php artisan config:cache command after the above steps.

                    – Sabyasachi Ghosh
                    Jan 14 at 10:08














                  12












                  12








                  12







                  cp .env.example .env if there is no .env file present.
                  php artisan key:generate command works for me. It generates the encryption key






                  share|improve this answer















                  cp .env.example .env if there is no .env file present.
                  php artisan key:generate command works for me. It generates the encryption key







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 29 '18 at 7:13









                  Kamran Syed

                  1436




                  1436










                  answered Jul 23 '17 at 15:18









                  Sabyasachi GhoshSabyasachi Ghosh

                  489313




                  489313













                  • clear the cache using php artisan config:cache command after the above steps.

                    – Sabyasachi Ghosh
                    Jan 14 at 10:08



















                  • clear the cache using php artisan config:cache command after the above steps.

                    – Sabyasachi Ghosh
                    Jan 14 at 10:08

















                  clear the cache using php artisan config:cache command after the above steps.

                  – Sabyasachi Ghosh
                  Jan 14 at 10:08





                  clear the cache using php artisan config:cache command after the above steps.

                  – Sabyasachi Ghosh
                  Jan 14 at 10:08











                  10














                  php artisan key:generate
                  php artisan config:cache


                  worked for me, but it had to be done in a command prompt on Windows.



                  Doing it inside the terminal in PHPStorm didn't worked.






                  share|improve this answer




























                    10














                    php artisan key:generate
                    php artisan config:cache


                    worked for me, but it had to be done in a command prompt on Windows.



                    Doing it inside the terminal in PHPStorm didn't worked.






                    share|improve this answer


























                      10












                      10








                      10







                      php artisan key:generate
                      php artisan config:cache


                      worked for me, but it had to be done in a command prompt on Windows.



                      Doing it inside the terminal in PHPStorm didn't worked.






                      share|improve this answer













                      php artisan key:generate
                      php artisan config:cache


                      worked for me, but it had to be done in a command prompt on Windows.



                      Doing it inside the terminal in PHPStorm didn't worked.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 11 '18 at 19:04









                      José MariaJosé Maria

                      12114




                      12114























                          7














                          A common issue you might experience when working on a Laravel application is the exception:




                          RuntimeException No application encryption key has been specified.




                          You'll often run into this when you pull down an existing Laravel application, where you copy the .env.example file to .env but don't set a value for the APP_KEY variable.



                          At the command line, issue the following Artisan command to generate a key:



                          php artisan key:generate


                          This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache



                          Also, you have to restart the server now you will not get to see this error message.






                          share|improve this answer






























                            7














                            A common issue you might experience when working on a Laravel application is the exception:




                            RuntimeException No application encryption key has been specified.




                            You'll often run into this when you pull down an existing Laravel application, where you copy the .env.example file to .env but don't set a value for the APP_KEY variable.



                            At the command line, issue the following Artisan command to generate a key:



                            php artisan key:generate


                            This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache



                            Also, you have to restart the server now you will not get to see this error message.






                            share|improve this answer




























                              7












                              7








                              7







                              A common issue you might experience when working on a Laravel application is the exception:




                              RuntimeException No application encryption key has been specified.




                              You'll often run into this when you pull down an existing Laravel application, where you copy the .env.example file to .env but don't set a value for the APP_KEY variable.



                              At the command line, issue the following Artisan command to generate a key:



                              php artisan key:generate


                              This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache



                              Also, you have to restart the server now you will not get to see this error message.






                              share|improve this answer















                              A common issue you might experience when working on a Laravel application is the exception:




                              RuntimeException No application encryption key has been specified.




                              You'll often run into this when you pull down an existing Laravel application, where you copy the .env.example file to .env but don't set a value for the APP_KEY variable.



                              At the command line, issue the following Artisan command to generate a key:



                              php artisan key:generate


                              This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache



                              Also, you have to restart the server now you will not get to see this error message.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jan 12 at 9:54

























                              answered Feb 27 '18 at 10:02









                              Udhav SarvaiyaUdhav Sarvaiya

                              1,89461624




                              1,89461624























                                  4














                                  Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:




                                  1. Rename or copy/rename .env.example file in the root of your project to .env.



                                  You should not just create empty .env file, but fill it with
                                  content of .env.example.





                                  1. In the terminal go to the project root directory(not public folder) and run



                                  php artisan key:generate





                                  1. If everything is okay, the response in the terminal should look like this



                                  Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=]
                                  set successfully.





                                  1. Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:



                                  APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=





                                  1. In terminal run



                                  php artisan config:cache




                                  That's it.






                                  share|improve this answer


























                                  • So php artisan key:generate didn't automatically add the key to your .env file?

                                    – Ross Wilson
                                    Jul 25 '18 at 12:39











                                  • No, in my case.

                                    – Dmitry Gordienko
                                    Jul 25 '18 at 12:48


















                                  4














                                  Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:




                                  1. Rename or copy/rename .env.example file in the root of your project to .env.



                                  You should not just create empty .env file, but fill it with
                                  content of .env.example.





                                  1. In the terminal go to the project root directory(not public folder) and run



                                  php artisan key:generate





                                  1. If everything is okay, the response in the terminal should look like this



                                  Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=]
                                  set successfully.





                                  1. Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:



                                  APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=





                                  1. In terminal run



                                  php artisan config:cache




                                  That's it.






                                  share|improve this answer


























                                  • So php artisan key:generate didn't automatically add the key to your .env file?

                                    – Ross Wilson
                                    Jul 25 '18 at 12:39











                                  • No, in my case.

                                    – Dmitry Gordienko
                                    Jul 25 '18 at 12:48
















                                  4












                                  4








                                  4







                                  Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:




                                  1. Rename or copy/rename .env.example file in the root of your project to .env.



                                  You should not just create empty .env file, but fill it with
                                  content of .env.example.





                                  1. In the terminal go to the project root directory(not public folder) and run



                                  php artisan key:generate





                                  1. If everything is okay, the response in the terminal should look like this



                                  Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=]
                                  set successfully.





                                  1. Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:



                                  APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=





                                  1. In terminal run



                                  php artisan config:cache




                                  That's it.






                                  share|improve this answer















                                  Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:




                                  1. Rename or copy/rename .env.example file in the root of your project to .env.



                                  You should not just create empty .env file, but fill it with
                                  content of .env.example.





                                  1. In the terminal go to the project root directory(not public folder) and run



                                  php artisan key:generate





                                  1. If everything is okay, the response in the terminal should look like this



                                  Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=]
                                  set successfully.





                                  1. Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:



                                  APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=





                                  1. In terminal run



                                  php artisan config:cache




                                  That's it.







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited Jan 8 at 5:56









                                  Prakash Pazhanisamy

                                  8681923




                                  8681923










                                  answered Jul 25 '18 at 11:49









                                  Dmitry GordienkoDmitry Gordienko

                                  716




                                  716













                                  • So php artisan key:generate didn't automatically add the key to your .env file?

                                    – Ross Wilson
                                    Jul 25 '18 at 12:39











                                  • No, in my case.

                                    – Dmitry Gordienko
                                    Jul 25 '18 at 12:48





















                                  • So php artisan key:generate didn't automatically add the key to your .env file?

                                    – Ross Wilson
                                    Jul 25 '18 at 12:39











                                  • No, in my case.

                                    – Dmitry Gordienko
                                    Jul 25 '18 at 12:48



















                                  So php artisan key:generate didn't automatically add the key to your .env file?

                                  – Ross Wilson
                                  Jul 25 '18 at 12:39





                                  So php artisan key:generate didn't automatically add the key to your .env file?

                                  – Ross Wilson
                                  Jul 25 '18 at 12:39













                                  No, in my case.

                                  – Dmitry Gordienko
                                  Jul 25 '18 at 12:48







                                  No, in my case.

                                  – Dmitry Gordienko
                                  Jul 25 '18 at 12:48













                                  3














                                  You can generate Application Encryption Key using this command:



                                  php artisan key:generate


                                  Then, create a cache file for faster configuration loading using this command:



                                  php artisan config:cache


                                  Or, serve the application on the PHP development server using this command:



                                  php artisan serve


                                  That's it!






                                  share|improve this answer






























                                    3














                                    You can generate Application Encryption Key using this command:



                                    php artisan key:generate


                                    Then, create a cache file for faster configuration loading using this command:



                                    php artisan config:cache


                                    Or, serve the application on the PHP development server using this command:



                                    php artisan serve


                                    That's it!






                                    share|improve this answer




























                                      3












                                      3








                                      3







                                      You can generate Application Encryption Key using this command:



                                      php artisan key:generate


                                      Then, create a cache file for faster configuration loading using this command:



                                      php artisan config:cache


                                      Or, serve the application on the PHP development server using this command:



                                      php artisan serve


                                      That's it!






                                      share|improve this answer















                                      You can generate Application Encryption Key using this command:



                                      php artisan key:generate


                                      Then, create a cache file for faster configuration loading using this command:



                                      php artisan config:cache


                                      Or, serve the application on the PHP development server using this command:



                                      php artisan serve


                                      That's it!







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Dec 31 '18 at 10:35

























                                      answered Dec 1 '18 at 10:06









                                      Prakash PazhanisamyPrakash Pazhanisamy

                                      8681923




                                      8681923















                                          Popular posts from this blog

                                          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                          Alcedinidae

                                          RAC Tourist Trophy