Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have a Laravel application which is working well, but whenever I view the log file there are hundreds of error
production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified.
exist in log file. There is a key in .
env
file and also I tried
php artisan key:generate
command as well but the error still generated in log file without any visible error to users.
This error only appears in the production server's log file, not in my development pc.
–
This will generate a random key, you must
restart the server
and you should no longer see the error message.
run the following commands to clear the cache.
php artisan config:clear
php artisan config:cache
–
–
–
–
I'm face to the same issue I have searched a lot but in a YouTube video comment I have found a solution (I'm not sure this solution is good or not) but worked for me
copy APP_KEY from .env file
and past in app.php file (located in: your_project\config)
Your app.php will look like
‘key’ => env(‘APP_KEY’, ‘base64:insert key here’),
I was stuck with this problem for a whole day and finally found out it was a permissions issue with the .env file. The file uploaded via scp has no read permissions.
chmod -744 .env
Hope this helps someone else with the same problem.
check the "key" variable form your config/app.php file, it should be
'key' => env('APP_KEY'),
make like this
'key' => "Your key",
And Restart your php server.
Yes the php artisan key:generate
will generate the key for you. like this in console
$php artisan key:generate
Application key [base64:soAqqNW/Kk85OclhmCKXj+u4nZGF142gEZHEY0Y1NXA=] set successfully.
you need to copy this key and put it into your .env file in APP_KEY=
parameter.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.