file_get_contents(/var/www/html/blog/.env): failed to open stream: No such file or directory laravel

file_get_contents(/var/www/html/blog/.env): failed to open stream: No such file or directory

This is a common error for beginners when starting new Laravel projects.

laravel error .env file

Step 1. Laravel .env File

This error in Laravel could mean that you have a default laravel install and have not setup the .env file. Simply make a copy of the example .env file they have provided in the default installation.

sudo mv .env.example .env

Step 2. Generate Key

Now, you probably need to generate a key before you can start the artisan server.

sudo php artisan key:generate

laravel generate key

Once the key has been generated and the .env file is now where it should be, you can start the artisan server.

Leave a Comment

Your email address will not be published. Required fields are marked *