Laravel environment files for local production and production maybe not working as intended?

In Laravel 4, I set up my local development machine (my laptop) and then I have my production server.

In my /bootstrap/start.php

$env = $app->detectEnvironment(array(

'local'      => array('MacBook-Pro-2.local'),
'production' => array('ripken'),

));

Then I created .env.local.php in my root directory as follows:

<?php

return [

// Database Connection Settings
'db_host'     => '127.0.0.1',
'db_name'     => 'censored',
'db_user'     => 'censored',
'db_password' => 'censored'

];

This part works. However, I went to my production server and created the exact same file called .env.production.php , and it does not load the variables from this file. I don’t know what made me think, but I renamed this .env.php file without “production” in the name and it works.

: .env.production.php ? , Laravel , .

+4
1

- , . Laravel "" "" , .

,

$env = $app->detectEnvironment(array(
'local'      => array('MacBook-Pro-2.local'),
'production' => array('ripken'),
));

$env = $app->detectEnvironment(array(
'local'      => array('MacBook-Pro-2.local'),    
));

, , "MacBook-Pro-2.local", . .env.php .

env - , .env.local.php .env.testing.php ..

+9

Source: https://habr.com/ru/post/1542654/


All Articles