I can't access my Heroku environment variables when I run a PHP script. On the picture below you can see that I have variable TEST_VAR
.
The code snippet below should output this variable, I get nothing instead:
$url = getenv('TEST_VAR');
echo $url;
I tried this and got 'Error!', so getenv('TEST_VAR')
is false
:
if (getenv('TEST_VAR')) {
$url = getenv('TEST_VAR');
echo $url;
} else {
die('Error!');
}
In this picture you can see the output of both snippets (empty string and Error!).