Support the ongoing development of Laravel.io →
posted 10 years ago
Installation
Last updated 2 years ago.
0

You have DB_HOST 3 times in database.php? :P

Last updated 2 years ago.
0

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)

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

It returns production, so I assume it should return development/local ?

Last updated 2 years ago.
0

it should return local if you want to use .env.local.php

can you paste the $app->detectEnvironment function from bootstrap/start.php

Last updated 2 years ago.
0
$env = $app->detectEnvironment(array(

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

));

Shouldn't the above code work?

Last updated 2 years ago.
0

A homestead provisioned virtual box will have the hostname as 'homestead'


$env = $app->detectEnvironment(array(

'local' => array('homestead'),

));

The above should get you working.

Last updated 2 years ago.
0

It worked, thank you very much! :)

Last updated 2 years ago.
0

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');
});
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Reached reached Joined 27 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.