You have DB_HOST 3 times in database.php? :P
Hehe good catch, wrong paste obviously :P
'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USERNAME'),
'password' => getenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
(Still same issue btw)
Maybe the env is not being caught properly? What does your detectEnvironment code look like and if you do
php artisan env
what is returned?
It returns production, so I assume it should return development/local ?
it should return local if you want to use .env.local.php
can you paste the $app->detectEnvironment function from bootstrap/start.php
$env = $app->detectEnvironment(array(
'local' => array('localhost'),
));
Shouldn't the above code work?
A homestead provisioned virtual box will have the hostname as 'homestead'
$env = $app->detectEnvironment(array(
'local' => array('homestead'),
));
The above should get you working.
Always a good idea to try and return the getenv() in a test route if you want to check your app can read it. Or in an error page, you'll see it at the bottom of the request data :)
Route::get('/dbinfo', function() {
return getenv('DB_HOST') . ' ' . getenv('DB_USERNAME');
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community