How to add environment variables to Homestead?

Hi all. Problem: can't get laravel to "see" environment variable.

I use homestead (vagrant box):
  • php 7.2.5
  • 2.1.2 vagrant
  • homestead 6.1.0
  • laravel 5.6


variable added in composer.json in the config section.
added to .env
added to variable in .bash_profile
added to the Homestead.yaml in variables and sites.params

Tried on the fly to add a variable using putenv(), none of it gave result.
In the stack trace, in the section "Environment Variables" I need a variable no.

Don't know on where to dig, please help.
March 12th 20 at 08:05
2 answers
March 12th 20 at 08:07
Solution
In General, as a temporary solution helped direct editing $_ENV.
But the next day earned .env, strangely, I did vagrant reload --provision many times.
March 12th 20 at 08:09
Variable must be declared for the same user which runs the web server that serves Laravel.

Moreover, you should pay attention to what is written in the description of the function putenv (about the variable names)

Find more questions by tags Vagrant