After using below command .env file no created in root
composer create-project --prefer-dist laravel/laravel project
and getting error while accessing url
Whoops, looks like something went wrong.
Is there any wrong with this command or any other setting ? any idea please share
You should create your .env
file using the .env.example
file to configure the database and everything else as needed. Be sure to generate a key with the artisan command key:generate
as well. By default, laravel uses the configuration files inside the config folder.
Its simple to resolve, just copy .env and copy content from .env.example
or
run bellow command:
cp .env.example .env
You can just make one in a text editor. There's nothing special about them. Just lookup an example of one and make sure you fill in all the necessary env variables.
vim .env
or
nano .env
from your app root and add the following:
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
Here's an online example if you need it.
EDIT
If you're worried about the file permissions, sudo chmod 644 .env
should be fine. Make sure you add .env
to your .gitignore
file if it's not already there. You should never track your environment variables in version control.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.