Ken
Ken

Reputation: 3141

Laravel Unable to Detect Application Environment

I have three environment folders in the config directory in Laravel: development, testing, and local. When I change the environment and hostname within the start.php file, only the production environment is recognized. Any thoughts on what I might be doing wrong here?

app/routes.php

//using this as a test to confirm that the correct environment is being used

Route::get('/', function()
{
   var_dump(App::environment());
});

bootstrap/start.php:

$env = $app->detectEnvironment(array(

'development' => array('localhost'),

));

Here, the result should be "string(11) "development". Instead, it's "string(10) "production".

Upvotes: 2

Views: 579

Answers (1)

lukasgeiter
lukasgeiter

Reputation: 152860

localhost probably isn't the real hostname of your machine.
You can find out your hostname by echoing gethostname(). Then use that instead of localhost

Upvotes: 2

Related Questions