Laravel 5 How to switch from Production mode

mikelovelyuk picture mikelovelyuk · Feb 25, 2015 · Viewed 145.6k times · Source

When I run $ php artisan env I get;

Current application environment: production

How can I change this to development or something similar? So I can see errors.. I have read a lot of the documentation but it is not at all easy for a newbie to understand. I don't have server config experience, really.

I'm sure there is "smart" way to do this, but all I am interested in, for now, is manually changing the environment. How do I do this?

Answer

Bogdan picture Bogdan · Feb 25, 2015

Laravel 5 gets its enviroment related variables from the .env file located in the root of your project. You just need to set APP_ENV to whatever you want, for example:

APP_ENV=development

This is used to identify the current enviroment. If you want to display errors, you'll need to enable debug mode in the same file:

APP_DEBUG=true

The role of the .env file is to allow you to have different settings depending on which machine you are running your application. So on your production server, the .env file settings would be different from your local development enviroment.