Support the ongoing development of Laravel.io →
posted 9 years ago
Configuration
Last updated 1 year ago.
0

By your config I'm guessing you are using laravel 4.2.

In order for your environment to work you should create a .env.local.php in the laravel root folder.

The environment detection is made like this:

  • .env.php - production
  • .env.local.php - local
  • .env.anyotherenvironmentyoulike.php - any other environment you like

Please not you should never create a .env.testing.php file. That one is reserved. When running unit tests, Laravel automatically sets the environment to "testing"

Your .env.local.php file should look like this:

return [
    'DB_HOST' => 'db.example.com',
    'DB_NAME' => 'database_name',
    'DB_USER' => 'database_username',
    'DB_PASSWORD' => 'database_password'
];
Last updated 9 years ago.
0

I tried to do this (though I don't understand the sub folder config files then??) But it still complains about these variables are unset?

0

I have read again you question

It's impossible for me to create configuration for my local environment, because Laravel keeps complaining that the production environment variables are empty and invalid.

Try running php artisan env in the terminal. That should tell you the detected environment

0

It gives me the same error

php artisan env
{"error":{"type":"ErrorException","message":"Undefined index: DB_HOST","file":"\/Applications\/XAMPP\/xamppfiles\/htdocs\/project\/app\/config\/database.php","line":57}}

I don't know if it can be XAMPP or something that crashes everything.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

emilmoe emilmoe Joined 23 Oct 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.