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

JohnRivs's avatar

Dealing with .env on Heroku

You can't manually create a file unless you do it locally and then push it using git. How do you go about creating the production .env? Config variables?

0 likes
6 replies
davorminchorov's avatar

You don't need ,env file for heroku. Config variables is for that. I believe it's similar for other servers too.

bashy's avatar

Can even set ENV vars in Nginx and Apache.

JohnRivs's avatar

If I go with using Heroku's Config Vars, env('APP_ENV') should still work, right?

JohnRivs's avatar

Alright then, because I knew how environment variables worked back in L4, and now that L5 uses phpdotenv I wasn't sure everything worked the same under the hood.

Thanks!

Please or to participate in this conversation.