Hi,
I have a website based on Laravel, and I don't want to keep the environmental file on the server. I want to move the environmental file from the production server to somewhere secure.
Any ideas or suggestions are welcomed
Hello @gautam071
It is possible to set the environment variable without the .env file. You need to set environments variable on your server but that depends on your system. It is the same idea as if you run env in your Linux shell.
In PHP you can see the variables with $_ENV (See: https://www.php.net/manual/en/reserved.variables.environment.php ) And if I'm correct Laravel will load the variables for you like the .env file.
On the other hand if someone has access to your production server he/she can not only read the .env file but also probably also access your env variable.
Maybe can encrypting your environment variable be interesting for you: https://laravel.com/docs/9.x/configuration#encrypting-environment-files
Hi @tvbeek
Thanks for sharing!
I will look into the reserved variables in PHP and I will try it out in my system.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community