1

Well, I'm trying to use a env var value in PHP 7.2 something like this

$var1 = getenv('AWS_REGION');
[some code bla bla bla]
echo $var1;

but returns this

 Expected string, but got bool(false)

Even I do echo the var and nothing happens

echo getenv('AWS_REGION');

So, in console in console print the variable and returns the value

echo $AWS_REGION
> us-east-2

I have tried everything : getenv, $_SERVER, etc. and nothing works. I'm not sure if I'm missing something.

Gamaor
  • 85
  • 3
  • How are you running the script? Environment variables in your login session are not the same as in the webserver. – Barmar Feb 10 '22 at 21:10

0 Answers0