Production error no application encryption key has been specified

I'm trying to use the Artisan command like this: 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

I’m trying to use the Artisan command like this:

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.

What’s the cause of this problem, and how can it be fixed?

I’m using Laravel framework 5.5-dev.

user's user avatar

user

5,4156 gold badges19 silver badges35 bronze badges

asked Jun 30, 2017 at 6:06

Carlos F's user avatar

2

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»

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 it using this query in google.com:
"laravel add encrption key" (Yes, it worked even with the typo!)

Note that if the .env file contains the key but you are still getting an application key error, then run php artisan config:cache to clear and reset the config.

answered Jun 30, 2017 at 6:08

Amarnasan's user avatar

AmarnasanAmarnasan

14.6k4 gold badges31 silver badges37 bronze badges

7

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

php artisan key:generate
php artisan config:cache

answered Jan 17, 2018 at 14:20

Leonid Dashko's user avatar

Leonid DashkoLeonid Dashko

3,4681 gold badge17 silver badges26 bronze badges

5

Open command prompt in the root folder of your project and run below command:

php artisan key:generate

It will generate Application Key for your application.

You can find the generated application key(APP_KEY) in .env file.

answered Jun 30, 2017 at 6:15

skm's user avatar

skmskm

1,1701 gold badge11 silver badges23 bronze badges

0

  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

answered Jan 10, 2018 at 8:14

Adam Pery's user avatar

Adam PeryAdam Pery

1,88621 silver badges20 bronze badges

1

Simply run this command:

php artisan key:generate

Udhav Sarvaiya's user avatar

answered Sep 12, 2017 at 6:18

Didinya Johnson's user avatar

2

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

Kamran Syed's user avatar

answered Jul 23, 2017 at 15:18

Sabyasachi Ghosh's user avatar

2

Open command prompt in the root folder of your project and run

php artisan key:generate

Then

php artisan config:cache

and Then

If you’re getting the same error after having key-value, then just copy the APP_KEY value from .env file and paste it to config/app.php with ‘key’ => ‘YOUR KEY’,

and then again run

php artisan config:cache

Hashmat's user avatar

Hashmat

1491 silver badge11 bronze badges

answered Nov 23, 2019 at 10:55

kaushik's user avatar

kaushikkaushik

8837 silver badges16 bronze badges

0

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.

Sᴀᴍ Onᴇᴌᴀ's user avatar

Sᴀᴍ Onᴇᴌᴀ

8,1028 gold badges32 silver badges58 bronze badges

answered Sep 11, 2017 at 15:35

Craig Kollross's user avatar

3

In 3 steps:

Generate new key php artisan key:generate

Clear the config php artisan config:clear

Update cache php artisan config:cache

answered Feb 4, 2021 at 11:47

Darlan Dieterich's user avatar

Darlan DieterichDarlan Dieterich

2,2291 gold badge27 silver badges37 bronze badges

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.

answered Feb 11, 2018 at 19:04

José Maria's user avatar

José MariaJosé Maria

1391 silver badge4 bronze badges

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, If you are using the PHP’s default web server (eg. php artisan serve) you need to restart the server changing your .env file values. now you will not get to see this error message.

answered Feb 27, 2018 at 10:02

Udhav Sarvaiya's user avatar

Udhav SarvaiyaUdhav Sarvaiya

9,05812 gold badges55 silver badges62 bronze badges

Follow this steps:

  1. php artisan key:generate
  2. php artisan config:cache
  3. php artisan serve

Udhav Sarvaiya's user avatar

answered Feb 3, 2019 at 5:10

Skandarajah Shyamalan's user avatar

2

Simply run command php artisan key:generate.. Still issue exist then run one more command php artisan config:cache and php artisan cache:clear ..

Now run php artisan serve

answered Jan 28, 2022 at 11:39

PHP Laravel Developer's user avatar

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.

Prakash Pazhanisamy's user avatar

answered Jul 25, 2018 at 11:49

Dmitry Gordienko's user avatar

2

I found that most answers are incomplete here. In case anyone else is still looking for this:

  1. Check if you have APP_KEY= in your .env, if not just add it without a value.
  2. Run this command: php artisan key:generate. This will fill in the value to the APP_KEY in your .env file.
  3. Finally, run php artisan config:cache in order to clear your config cache and recache your config with the new APP_KEY value.

answered Nov 2, 2020 at 9:21

Diligence Vagere's user avatar

0

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!

answered Dec 1, 2018 at 10:06

Prakash Pazhanisamy's user avatar

If you git clone some project then this kind of issue may usually occur.

  1. make sure there is .env file
  2. run php artisan key:generate and then it should generate APP_KEY in .env
  3. finally run php artisan serve and it should be working.

Top-Master's user avatar

Top-Master

6,7005 gold badges34 silver badges60 bronze badges

answered Mar 8, 2019 at 11:20

Jasbin Karki's user avatar

If you don’t have a .env file then run the below command, else skip this

cp .env.example .env

Then run the below artisan command and it will generate an application key for your project:

php artisan key:generate

Note: Your APP_KEY is inside your .env file.

answered Jul 10, 2021 at 7:57

Hedayatullah Sarwary's user avatar

If after running php artisan key:generate issue is not resolved, check your .env file.

Search for APP_KEY=.

If it doesn’t exist, manually add it to .env file and run php artisan key:generate again.

After this you will see generated key in .env file.

Copy that key and paste it in /config/app.php (search for APP_KEY there as well). You should end up with something like this in app.php file

'key' => env('APP_KEY', 'base64:...'),

Then run php artisan serve (You might have to run php artisan config:cache at some point. Not 100% sure when)

answered Dec 29, 2021 at 11:21

temo's user avatar

temotemo

6121 gold badge9 silver badges24 bronze badges

I ran into this issue when I manually copied the contents of my Laravel project (say sites/oldname) into a new directory on my Mac (say, sites/newname). Since I was manually dragging and droppping, it didn’t grab the hidden files, namely, ‘.env’.
When I looked more closely at sites/oldname I saw .editorconfig, .env, .env.example, .gitatrributes, .styleci.yml, etc.

The error went away once I copied the hidden files to the new directory.

So, «No Application Encryption Key Has Been Specified» is Laravel speak for «your .env file is missing.»

answered Jun 5, 2019 at 15:24

JJ Rohrer's user avatar

JJ RohrerJJ Rohrer

2,5924 gold badges29 silver badges35 bronze badges

Sometimes If everything Fails Use this:

Goto: laravelProject/config/app.php

Find the line: 'key' => and check to what it refers,

It can either be one of two:

Case 1: env('APP_KEY')
Case 2: "somekeystring"

For Case 1:
Goto your .env file after you have run cp -a .env.example .env
Enter a random string like 10101010101010101010101010101010

Now, run php artisan key:generate

Your key will be updated automatically.

For Case 2:
set a random string like for value of Key 10101010101010101010101010101010

Now, run php artisan key:generate

Your key will be updated automatically.

answered Sep 23, 2020 at 10:14

imshashi17's user avatar

imshashi17imshashi17

1671 gold badge3 silver badges11 bronze badges

Facing the Same Issue in Laravel v8.49.0 (PHP v8.0.6) Solution
genrate app key

  1. Click

Genrate app key

succesfully genrate key

  1. Click on Refresh now

answered Jul 2, 2021 at 4:44

Sarthak Raval's user avatar

Sarthak RavalSarthak Raval

9051 gold badge10 silver badges23 bronze badges

simply run

php artisan key:generate

its worked for me

answered Dec 27, 2019 at 5:51

Dimuthu's user avatar

DimuthuDimuthu

4174 silver badges11 bronze badges

Try setting correct file permissions

chmod -R 777 storage/
chmod 777 bootstrap/cache/

answered Sep 23, 2022 at 14:39

Danon's user avatar

DanonDanon

2,56425 silver badges37 bronze badges

Run below command to set app key

php artisan key:generate

By running the above command, it sets the key value in .env of your project directory which is referenced in the app config

// .env
APP_KEY=base64:XkrFWC+TGnySY2LsldPXAxuHpyjh8UuoPMt6yy2gJ8U=


// config/app.php
'key' => env(APP_KEY);

Restart your server, in order to reflect the above change.

answered Jan 2 at 12:30

Ankit Jindal's user avatar

Ankit JindalAnkit Jindal

3,3713 gold badges23 silver badges35 bronze badges

I had to restart my queue worker using php artisan queue:restart after running php artisan key:generate to get jobs working.

answered Sep 16, 2019 at 8:19

Joel Peltonen's user avatar

Joel PeltonenJoel Peltonen

12.8k6 gold badges64 silver badges99 bronze badges

Hello!

I get this error

production.ERROR: No application encryption key has been specified.

when I frequently (more than 3 times/second) send requests to the server using AJAX (axios exactly).

I wonder why it is production.ERROR, because in my .env it is APP_ENV=local. Obviously, my APP_KEY is present.

Full trace:

[2018-10-06 11:09:05] production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at <>\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:42)
[stacktrace]
#0 <>\vendor\laravel\framework\src\Illuminate\Support\helpers.php(1038): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(NULL)
#1 <>\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(46): tap(NULL, Object(Closure))
#2 <>\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(24): Illuminate\Encryption\EncryptionServiceProvider->key(Array)
#3 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(749): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application), Array)
#4 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(631): Illuminate\Container\Container->build(Object(Closure))
#5 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(586): Illuminate\Container\Container->resolve('encrypter', Array)
#6 <>\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(732): Illuminate\Container\Container->make('encrypter', Array)
#7 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(885): Illuminate\Foundation\Application->make('encrypter')
#8 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(813): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#9 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(780): Illuminate\Container\Container->resolveDependencies(Array)
#10 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(631): Illuminate\Container\Container->build('App\\Http\\Middle...')
#11 <>\vendor\laravel\framework\src\Illuminate\Container\Container.php(586): Illuminate\Container\Container->resolve('App\\Http\\Middle...', Array)
#12 <>\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(732): Illuminate\Container\Container->make('App\\Http\\Middle...', Array)
#13 <>\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(215): Illuminate\Foundation\Application->make('App\\Http\\Middle...')
#14 <>\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(189): Illuminate\Foundation\Http\Kernel->terminateMiddleware(Object(Illuminate\Http\Request), Object(Illuminate\Http\JsonResponse))
#15 <>\public\index.php(60): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\JsonResponse))
#16 {main}
"} 

Route, connected to the issue has GET method and auth middleware.

Responsible route’s method resturns collection:

    $users = User::select(...)->get();
    return response($users);

This issue happens time-to-time, but I’m worried about getting it on product staging.

I’m trying to use the Artisan command like this:

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.

What’s the cause of this problem, and how can it be fixed?

I’m using Laravel framework 5.5-dev.

user's user avatar

user

5,4156 gold badges19 silver badges35 bronze badges

asked Jun 30, 2017 at 6:06

Carlos F's user avatar

2

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»

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 it using this query in google.com:
"laravel add encrption key" (Yes, it worked even with the typo!)

Note that if the .env file contains the key but you are still getting an application key error, then run php artisan config:cache to clear and reset the config.

answered Jun 30, 2017 at 6:08

Amarnasan's user avatar

AmarnasanAmarnasan

14.6k4 gold badges31 silver badges37 bronze badges

7

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

php artisan key:generate
php artisan config:cache

answered Jan 17, 2018 at 14:20

Leonid Dashko's user avatar

Leonid DashkoLeonid Dashko

3,4681 gold badge17 silver badges26 bronze badges

5

Open command prompt in the root folder of your project and run below command:

php artisan key:generate

It will generate Application Key for your application.

You can find the generated application key(APP_KEY) in .env file.

answered Jun 30, 2017 at 6:15

skm's user avatar

skmskm

1,1701 gold badge11 silver badges23 bronze badges

0

  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

answered Jan 10, 2018 at 8:14

Adam Pery's user avatar

Adam PeryAdam Pery

1,88621 silver badges20 bronze badges

1

Simply run this command:

php artisan key:generate

Udhav Sarvaiya's user avatar

answered Sep 12, 2017 at 6:18

Didinya Johnson's user avatar

2

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

Kamran Syed's user avatar

answered Jul 23, 2017 at 15:18

Sabyasachi Ghosh's user avatar

2

Open command prompt in the root folder of your project and run

php artisan key:generate

Then

php artisan config:cache

and Then

If you’re getting the same error after having key-value, then just copy the APP_KEY value from .env file and paste it to config/app.php with ‘key’ => ‘YOUR KEY’,

and then again run

php artisan config:cache

Hashmat's user avatar

Hashmat

1491 silver badge11 bronze badges

answered Nov 23, 2019 at 10:55

kaushik's user avatar

kaushikkaushik

8837 silver badges16 bronze badges

0

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.

Sᴀᴍ Onᴇᴌᴀ's user avatar

Sᴀᴍ Onᴇᴌᴀ

8,1028 gold badges32 silver badges58 bronze badges

answered Sep 11, 2017 at 15:35

Craig Kollross's user avatar

3

In 3 steps:

Generate new key php artisan key:generate

Clear the config php artisan config:clear

Update cache php artisan config:cache

answered Feb 4, 2021 at 11:47

Darlan Dieterich's user avatar

Darlan DieterichDarlan Dieterich

2,2291 gold badge27 silver badges37 bronze badges

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.

answered Feb 11, 2018 at 19:04

José Maria's user avatar

José MariaJosé Maria

1391 silver badge4 bronze badges

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, If you are using the PHP’s default web server (eg. php artisan serve) you need to restart the server changing your .env file values. now you will not get to see this error message.

answered Feb 27, 2018 at 10:02

Udhav Sarvaiya's user avatar

Udhav SarvaiyaUdhav Sarvaiya

9,05812 gold badges55 silver badges62 bronze badges

Follow this steps:

  1. php artisan key:generate
  2. php artisan config:cache
  3. php artisan serve

Udhav Sarvaiya's user avatar

answered Feb 3, 2019 at 5:10

Skandarajah Shyamalan's user avatar

2

Simply run command php artisan key:generate.. Still issue exist then run one more command php artisan config:cache and php artisan cache:clear ..

Now run php artisan serve

answered Jan 28, 2022 at 11:39

PHP Laravel Developer's user avatar

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.

Prakash Pazhanisamy's user avatar

answered Jul 25, 2018 at 11:49

Dmitry Gordienko's user avatar

2

I found that most answers are incomplete here. In case anyone else is still looking for this:

  1. Check if you have APP_KEY= in your .env, if not just add it without a value.
  2. Run this command: php artisan key:generate. This will fill in the value to the APP_KEY in your .env file.
  3. Finally, run php artisan config:cache in order to clear your config cache and recache your config with the new APP_KEY value.

answered Nov 2, 2020 at 9:21

Diligence Vagere's user avatar

0

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!

answered Dec 1, 2018 at 10:06

Prakash Pazhanisamy's user avatar

If you git clone some project then this kind of issue may usually occur.

  1. make sure there is .env file
  2. run php artisan key:generate and then it should generate APP_KEY in .env
  3. finally run php artisan serve and it should be working.

Top-Master's user avatar

Top-Master

6,7005 gold badges34 silver badges60 bronze badges

answered Mar 8, 2019 at 11:20

Jasbin Karki's user avatar

If you don’t have a .env file then run the below command, else skip this

cp .env.example .env

Then run the below artisan command and it will generate an application key for your project:

php artisan key:generate

Note: Your APP_KEY is inside your .env file.

answered Jul 10, 2021 at 7:57

Hedayatullah Sarwary's user avatar

If after running php artisan key:generate issue is not resolved, check your .env file.

Search for APP_KEY=.

If it doesn’t exist, manually add it to .env file and run php artisan key:generate again.

After this you will see generated key in .env file.

Copy that key and paste it in /config/app.php (search for APP_KEY there as well). You should end up with something like this in app.php file

'key' => env('APP_KEY', 'base64:...'),

Then run php artisan serve (You might have to run php artisan config:cache at some point. Not 100% sure when)

answered Dec 29, 2021 at 11:21

temo's user avatar

temotemo

6121 gold badge9 silver badges24 bronze badges

I ran into this issue when I manually copied the contents of my Laravel project (say sites/oldname) into a new directory on my Mac (say, sites/newname). Since I was manually dragging and droppping, it didn’t grab the hidden files, namely, ‘.env’.
When I looked more closely at sites/oldname I saw .editorconfig, .env, .env.example, .gitatrributes, .styleci.yml, etc.

The error went away once I copied the hidden files to the new directory.

So, «No Application Encryption Key Has Been Specified» is Laravel speak for «your .env file is missing.»

answered Jun 5, 2019 at 15:24

JJ Rohrer's user avatar

JJ RohrerJJ Rohrer

2,5924 gold badges29 silver badges35 bronze badges

Sometimes If everything Fails Use this:

Goto: laravelProject/config/app.php

Find the line: 'key' => and check to what it refers,

It can either be one of two:

Case 1: env('APP_KEY')
Case 2: "somekeystring"

For Case 1:
Goto your .env file after you have run cp -a .env.example .env
Enter a random string like 10101010101010101010101010101010

Now, run php artisan key:generate

Your key will be updated automatically.

For Case 2:
set a random string like for value of Key 10101010101010101010101010101010

Now, run php artisan key:generate

Your key will be updated automatically.

answered Sep 23, 2020 at 10:14

imshashi17's user avatar

imshashi17imshashi17

1671 gold badge3 silver badges11 bronze badges

Facing the Same Issue in Laravel v8.49.0 (PHP v8.0.6) Solution
genrate app key

  1. Click

Genrate app key

succesfully genrate key

  1. Click on Refresh now

answered Jul 2, 2021 at 4:44

Sarthak Raval's user avatar

Sarthak RavalSarthak Raval

9051 gold badge10 silver badges23 bronze badges

simply run

php artisan key:generate

its worked for me

answered Dec 27, 2019 at 5:51

Dimuthu's user avatar

DimuthuDimuthu

4174 silver badges11 bronze badges

Try setting correct file permissions

chmod -R 777 storage/
chmod 777 bootstrap/cache/

answered Sep 23, 2022 at 14:39

Danon's user avatar

DanonDanon

2,56425 silver badges37 bronze badges

Run below command to set app key

php artisan key:generate

By running the above command, it sets the key value in .env of your project directory which is referenced in the app config

// .env
APP_KEY=base64:XkrFWC+TGnySY2LsldPXAxuHpyjh8UuoPMt6yy2gJ8U=


// config/app.php
'key' => env(APP_KEY);

Restart your server, in order to reflect the above change.

answered Jan 2 at 12:30

Ankit Jindal's user avatar

Ankit JindalAnkit Jindal

3,3713 gold badges23 silver badges35 bronze badges

I had to restart my queue worker using php artisan queue:restart after running php artisan key:generate to get jobs working.

answered Sep 16, 2019 at 8:19

Joel Peltonen's user avatar

Joel PeltonenJoel Peltonen

12.8k6 gold badges64 silver badges99 bronze badges

Сделал для себя приложение, которое работает на локальном компьютере, есть одна страница, с которой идет очень много ajax запросов на другую страницу, все работает, но иногда я получаю 500 ошибку, где то 1 раз в 50-100-200 запросов, в логах:

[2022-01-04 12:15:23] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\Encryption\MissingAppKeyException(code: 0): No application encryption key has been specified. at W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:79)
[stacktrace]
#0 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Support\helpers.php(263): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#1 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(81): tap()
#2 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(60): Illuminate\Encryption\EncryptionServiceProvider->key()
#3 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(32): Illuminate\Encryption\EncryptionServiceProvider->parseKey()
#4 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(829): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#5 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(714): Illuminate\Container\Container->build()
#6 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(841): Illuminate\Container\Container->resolve()
#7 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(652): Illuminate\Foundation\Application->resolve()
#8 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(826): Illuminate\Container\Container->make()
#9 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(987): Illuminate\Foundation\Application->make()
#10 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(907): Illuminate\Container\Container->resolveClass()
#11 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(868): Illuminate\Container\Container->resolveDependencies()
#12 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(714): Illuminate\Container\Container->build()
#13 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(841): Illuminate\Container\Container->resolve()
#14 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Container\Container.php(652): Illuminate\Foundation\Application->resolve()
#15 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(826): Illuminate\Container\Container->make()
#16 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(156): Illuminate\Foundation\Application->make()
#17 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Routing\Router.php(697): Illuminate\Pipeline\Pipeline->then()
#19 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Routing\Router.php(672): Illuminate\Routing\Router->runRouteWithinStack()
#20 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Routing\Router.php(636): Illuminate\Routing\Router->runRoute()
#21 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Routing\Router.php(625): Illuminate\Routing\Router->dispatchToRoute()
#22 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(166): Illuminate\Routing\Router->dispatch()
#23 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#24 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#25 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#26 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#27 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#28 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#29 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#30 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#31 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#32 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#33 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#34 W:\domains\site.local\vendor\fruitcake\laravel-cors\src\HandleCors.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#35 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Fruitcake\Cors\HandleCors->handle()
#36 W:\domains\site.local\vendor\fideloper\proxy\src\TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#37 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()
#38 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(141): Illuminate\Pipeline\Pipeline->then()
#40 W:\domains\site.local\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#41 W:\domains\site.local\public\index.php(52): Illuminate\Foundation\Http\Kernel->handle()
#42 {main}
"} 

в гугле находит информацию где всегда выдает эту ошибку, а у меня только иногда, а так все стабильно работает, как надо.
Что это может быть? как это исправить?

думаю будет важной информацией: в laravel я не силен, делал методом тыка, работает и сойдет, по этому всякие конфиги либо не настраивал либо минимально настраивал.

в файле configapp.php

в .env (ключ немного изменен, но он есть)

APP_KEY=base64:BIfnCyZe9uzGkCQ64kME9rZ+dBYWRZJ27I9uMrNb8b0=

Изменено GTX (04.01.2022 16:13:42)


Изучаю Laravel, до этого дела с фреймворками не имел.
Печальные познания в английском.

Понравилась статья? Поделить с друзьями:
  • Procedure too large vba ошибка как исправить
  • Problem to run or locate the batch file install cmd как исправить
  • Privoxy encountered an error while processing your request
  • Postgresql rollback if error
  • Playstation store ошибка wc 34737 4