I am install "Laravel Framework version 5.2.26" but i am getting error for key generate in my ubuntu os
user@CN43:/var/www/html/laravel_1$ php artisan key:generate
[ErrorException]
file_get_contents(/var/www/html/laravel_1/.env): failed to open stream: No
such file or directory
After that i will update .env.example
file to .env
and update all information in .env
file after key generate command return that key is
user@CN43:/var/www/html/laravel_1$ php artisan key:generate
Application key [base64:uD6hjLx+j1uMYDBEi7GMz8eMgD/KHc8W27rwSko8Cos=] set successfully.
but that key is not working. what is wrong???
In my console error in chrome is
Failed to load resource: net::ERR_EMPTY_RESPONSE
http://localhost/laravel_1/public/:1 GET http://localhost/laravel_1/public/ net::ERR_EMPTY_RESPONSE
http://localhost/laravel_1/public/:1 GET http://localhost/laravel_1/public/ net::ERR_EMPTY_RESPONSE
.env
file
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:i7WQo9iUSQud+Oi90HGJzonE4w+SPaV3NI3AMBnee3A=
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_master
DB_USERNAME=root
DB_PASSWORD=123
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
If you have just run "php artisan vendor:publish" like I did. Then most likely your artisan has been updated but not your larafel/framework. Run "composer update"
and then rerun "php artisan key:generate"
you will see the difference in your .env file, copy the key and put it in config/app.php in this format:
'key' => env('APP_KEY', 'base64:xxxxxxxxxxxxxxxxxxxx=')
Now your app should back and running properly.
You can copy the .env.example to .env in your laravel root folder
I had the same issue, you have to change the .env by doing this cp .env.example .env php artisan key:generate
ref: laravel install getting key generate error in ubunto OS
Run cp .env.example .env then php artisan key:generate Copy the displayed key something like, "base64:xxxxxxxxxxxxxxxxxxxxxxxxxxxx="
Then go to yourAppName\config\app.php then paste the copied key in it(around line 107) then Save.
Run php artisan serve