Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MichalJ's avatar

config/app.php [deploy]

0 likes
7 replies
samo's avatar
samo
Best Answer
Level 24

That works out of the box with laravel as i said in your other thread

https://laravel.com/docs/master/configuration

So you dont need to touch your config files, just use $_ENV in your configs - like laravel do it out of the box with many own variables als you can see in the config files - and create a .env for your different levels of deployment. Keep this .env files ignored from git or others to secure your data

bashy's avatar

Using .env to send your variables in production may return some issues. I would put them in your php-fpm pool config for the site.

1 like
samo's avatar

Ya that would be a option too

Can you name that "issues"? Heard from a few persons who also ran into problems with the php-fpm pool way

1 like
mikevrind's avatar

I also use the .env file, never had any problems with it.

bashy's avatar

@samo basically some systems (don't know why) don't load or parse the file correctly and it will result in the default being used (where ever you call env('VAR')).

1 like
MichalJ's avatar

I am new to laravel and this forum. However I think that bashy has a point. I have same problem with database connection. Basically config/database.php ignores my ENV variables. I am probably doing something wrong. Or maybe not. That is the reason why I decided to "spam" laracas forums. :D

Thank you for your help though. I'll try to read documentation more.

bashy's avatar

@MichalJ Well, is it all the time? The issues with .env files would only be on occasion.

Please or to participate in this conversation.