Reputation: 10447
I'm trying to change the environment in my app from local to production. I've modified the .env file but whenever I run a query it's not using the config I have in config/database.php, or the database settings in .env, but the default homestead @ localhost. How can I change the environment to production?
Upvotes: 1
Views: 2709
Reputation: 51
Put the following line into your boostrap/app.php
$app->loadEnvironmentFrom('.local.env');
you can change the file name here ('.local.env') what environment file need to run
Upvotes: 1
Reputation: 10447
As per my comment all I needed to do was restart the server, in my case artisan serve
. It only loads the environment when starting, so any changes don't take effect whilst it's running.
Upvotes: 0
Reputation: 178
In Laravel 5 the .env file is the file you need to edit. The DB values are stored there.
This file should be in .gitignore as there is a .env.example
change the
APP_ENV=production
APP_DEBUG=false
APP_KEY=yourkey
DB_HOST=tost
DB_DATABASE=db
DB_USERNAME=un
DB_PASSWORD=pwd
CACHE_DRIVER=file
SESSION_DRIVER=file
to look like that on your production environment as it no longer uses the values in config/database
files in that config dir should keep config that is the same across environments
Upvotes: 0