0

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 ?

2 Answers 2

2

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'),

));
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.