Reputation: 4379
Trying to set the environment variable from commandline like
php artisan serve --env=someenv
But a var_dump(App::environment())
outputs string 'production' (length=10)
.
Shouldn't it be someenv
?
Upvotes: 0
Views: 4300
Reputation: 1602
Laravel 5 can use a .env file in your installation base directory to determine your environment. For example, to set the current environment as the „local“ one, create a file .env with
APP_ENV = local
Please see another answer for more details on this mechanism.
Upvotes: 0
Reputation: 87719
This environment you set on php artisan seve
is just for that particular command, running on cli.
Note that this is not you application running, just a webserver, provided by PHP so you don't need to install a full apache or nginx to test your application.
Your web application will run under a different environment and you still need to provide a correct environment adding it to your bootstrap/start.php file:
$env = $app->detectEnvironment(array(
'local' => array('localhost', '127.0.0.1', 'example.com'),
));
Upvotes: 2