How to generate .env file for laravel?
Just tried both ways and in both ways I got generated .env
file:
Composer should automatically create .env file. In the post-create-project-cmd
section of the composer.json
you can find:
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
Both ways use the same composer.json
file, so there shoudn't be any difference.
I suggest you to update laravel/installer
to the last version: 1.2 and try again:
composer global require "laravel/installer=~1.2"
You can always generate .env
file manually by running:
cp .env.example .env
php artisan key:generate
In windows OS, you can open command prompt, change directory to your project directory.
Example,
My project directory
E:\xampp\htdocs\my_project
You can type into your Command prompt like this (hit enter each line):
E:
cd xampp\htdocs\my_project
Then you can type,
copy .env.example .env
If you are using Linux, you can type cp, instead of copy