Support the ongoing development of Laravel.io →
Laravel Encryption
Last updated by @gautam071 1 week ago.
0
moderator Solution

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-environm...

1
Solution selected by @driesvints

Hi @tvbeek

Thanks for sharing!

I will look into the reserved variables in PHP and I will try it out in my system.

1

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Gautam gautam071 Joined 12 Jan 2023

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.

© 2023 Laravel.io - All rights reserved.