I
I
i1yas2018-10-10 11:53:46
Vagrant
i1yas, 2018-10-10 11:53:46

How to add environment variables to Homestead?

Hi all. The problem is this: I can't get laravel to "see" the environment variable.
I use homestead (vagrant box):

  • php7.2.5
  • vagrant 2.1.2
  • homestead 6.1.0
  • laravel 5.6

added a variable to composer.json in the config section.
added to .env
added to variable in .bash_profile
added to Homestead.yaml, to variables and to sites.params
Tried to add a variable on the fly with putenv(), none of this worked.
In the stack trace, in the "Environment Variables" section, there is no variable I need.
I do not know where to dig further, please help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
i1yas, 2018-10-12
@i1yas

In general, direct editing of $_ENV helped as a temporary solution.
But the .env worked the next day, strange, I did vagrant reload --provision many times.

A
Andrey Yumashev, 2018-10-10
@skazkin

The variable must be declared for the user that runs the web server that serves Laravel.
In addition, you should pay attention to what is written in the description of the putenv function (about variable names)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question