Support the ongoing development of Laravel.io →
Installation Configuration Database
Last updated 1 year ago.
0

I'm having the same issue but with a site deployed by Forge. Locally using Homestead where I set the environment variables manually in /etc/nginx/sites-available/default I can use getenv('var') in the database connections but this doesn't work on a site I've deployed on Digital Ocean.

I have tried setting the env vars manually on the DO server, through Forge, etc. with no luck. If I create a test.php file in my public directory and run getenv('var') i am able to see the value. This has to be something with laravel but can't figure out where/why it is happening.

Last updated 1 year ago.
0

I have tried setting the env vars manually on the DO server, through Forge, etc. with no luck.

Using Forge to manage server environment and have yet to see any problem.

Last updated 1 year ago.
0

cyrnobone are you using getenv() or $_ENV? Also, are you using it for db credentials?

In theory it should work as the forge server is configured the same as my others, it seems to come down to laravel not returning the environment variable from getenv()

Last updated 1 year ago.
0

I was using named sub-directories in my app/config/ directory that corresponded to my environment names and everything was working fine (ie - "production" folder to pull up production configs/database credentials).

Then I upgraded from 4.1 to 4.2 and the environment params were no longer being read. An if() statement in main app.php and database.php files restored order…

if(app()->environment() === 'development')

But this solution requires having all of my database credentials in one file with a switch statement. Are sub-directory environment configs out? Curious.

Last updated 1 year ago.
0

Guys sorry I solved this problem last week I totally forgot to update this. Laravel environmental variables are kept separate from Google app engine. To get it to work you need to put the environmental variables where you store your laravel environmental variables.

If you don't know what I'm talking about you just create a .env.php in the laravel root folder and place

<?php return array( 'DEVELOPMENT_DB_HOST' => 'localhost', ... ); Hope this helps someone
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

thagee thagee Joined 8 Jul 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.