How to deal with the error "Your app key is missing" when running php artisan in Laravel
Thank you for your continued support.
This article contains advertisements that help fund our operations.
Table Of Contents
This article summarizes how to deal with the error "Your app key is missing" that occurs when running php artisan after cloning from Github in Laravel.
error message
No application encryption key has been specified.
Your app key is missing
Generate your application encryption key using php artisan key:generate.
Conclusion
Running the command
php artisan key:generate
and putting the generated string into the line around line 3 of the .env file,
APP_KEY=
will resolve the issue.
(If you have created a Laravel project yourself, the string should already be filled in here, so there is no need to do anything special)
Explanation
When cloning a Laravel project from Github, etc., there is no .env file.
So, create an .env file by copying it from .env.example, for example.
However, in the initial state of .env.example,
APP_KEY=
is empty.
Laravel will throw an error if this is empty, so you need to run the command mentioned earlier.
Related articles
Solution when processing stops due to insufficient memory in EC2, Laravel, Queue
Troubleshooting when composer require command does not work well with versions in Laravel
Summary
That's it.
In a development environment, the answer is written on the error screen (php artisan key:generate), but I wrote this in case you might not notice it when you upload it to the server! I hope you find it helpful!
If you have any feedback, opinions, etc., please contact me via DM on Twitter.
That's all!
Popular articles
Deploying a PHP7.4 + Laravel6 project to AWS EC2
Implementing breadcrumbs in Laravel with laravel-breadcrumbs