Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 views
in Technique[技术] by (71.8m points)

php - Laravel 4.2 says my application is in production. How do I turn this off?

I have a fresh install of Laravel. When running php artisan migrate:refresh I get a message saying Application In Production! Do you really wish to run this command?'

I know this is an update in 4.2, however I can't figure out how to turn it off.

I found in the source that it comes from IlluminateConsoleConfirmableTrait and runs if this if test passes : if ($this->getLaravel()->environment() == 'production')

I'm not sure why it thinks I'm in production. I never setup any environments. This is the default environment detection, which I'm still currently using.

$env = $app->detectEnvironment(array(

    'local' => array('homestead')

));

Also, if I set a production environment to a hostname that isn't my machine, I still have the same problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just specify a machine name for the host that matches a given environment, then laravel will automatically detect the environment (default is production), for example:

$env = $app->detectEnvironment(array(

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

    'local' => array('*.dev', gethostname()),
    'production' => array('*.com', '*.net', 'www.somedomain.com')
));

Read the documentation and this answer as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...