Yeah, either of those works.
To be consistent I would choose creating the .env file by myself on the production server.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey, pretty new to actually hosting websites, and just practicing my workflow etc... Whats the best way to set up the production environment on my host?
From what I can see you can set environment variables in the .env file... however, lets say i create a new Laravel app, I edit my local config in .env... then push to GitHub, then SSH into my hosting server and git pull... then there is no .env file there, obviously because .env files are ignored ... and I cant edit the Laravel config files as they would be published on GitHub...
So what do I do next? manually FTP a production .env file to the server? Or should I set environment variables on the server via ssh, or do I have to edit .htaccess files etc? and if so, how?
How do I go about setting this up?
Please or to participate in this conversation.