Laravel 4.2 Says My Application Is in Production. How to Turn This Off

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

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.

Laravel 4.2 Environments

The default environment is always production, so you can leave it out of the array. For the other problem of having two different hostnames for you local dev, you can add them as array values of for the array local environment key.

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

Changing default environment in Laravel 4

Thanks Antonio for prompting me to reconsider domain detection.

$env = $app->detectEnvironment(array(
(
// Empty string is to set development as the default environment for
// artisan commands.
'development' => array('dev.foo.com', ''),
'test' => array('test.foo.com'),
'production' => array('www.foo.com', 'foo.com'),
));

Adding '' as a development domain effectively sets development as the default environment for artisan commands, presumably because the domain name is blank when the application is invoked from the command line. I tested and it seems anything == false will work. I also verified this does not interfere with the detection of the production or testing environments.

Laravel quickstart migration doesn't work

Have solved it using a MySQL server and avoiding phpMyAdmin, since it is not working for me using the migrations commands.

Laravel 4.2: Forcing seed on migrate:refresh in production

--no-interaction will do the job.

Other way would be such single call:

artisan migrate:refresh --force && artisan db:seed --force

Laravel Environment

I think you're not using detectEnvironment correctly. In this function, YOU are supposed to return the environment used, based on a config file, or an external environment variable - not get the environment. If you look at the documentation, you'll see some samples on how to use detectEnvironment properly, with both config file, or external variable (e.g. set the environment variable MY_LARVEL_ENV=local at the command line, and access it using $_SERVER['MY_LARAVEL_ENV'] inside the function, to return the proper environment.

How to turn on the Laravel informative stack trace?

By default, Laravel is set to be in the production environment. Instead of changing the default debug value for production you should set the environment for your machine as the local environment.

To set your machine as the local environment, open bootstrap/start.php and add your computer's hostname to:

$env = $app->detectEnvironment(array(

'local' => array('your-machine-name'),

));

To find your machine's name, run hostname from the command line.



Related Topics



Leave a reply



Submit