mercredi 1 avril 2020

PHP environmental variables are null through the web server

I am using docker to create a container with the centOS in which I have a nginx web server. I have a bunch of environmental variables that were declared in the docker-compose file(e.x. APP_ENV=docker). When I access one site from the web server every environmental variable that was from the docker-compose file is null(I have tried getenv(), $_SERVER[], $_ENV[]). Interestingly enough, when I run echo $APP_ENV in the bash I get docker. More interestingly, when I run this echo(_ENV['APP_ENV']); I get docker. I use the phpstorm ide.

I ran the echo(_ENV['APP_ENV']); when I ran the php shell in the bash.




Aucun commentaire:

Enregistrer un commentaire