I am using mysqli with environment variables set in .htacess to connect to a external database, which was working fine for months with no changes to that code.
But suddenly, noticed yesterday that, out of nowhere, those environment variables were no longer being recognized, marking them as NULL.
That happened to my 2 websites (since they have the same code for the mysqli connection)
Here’s what’s going on with a test var:
Doing just a normal echo (also tested with $_SERVER and getenv
echo ($_ENV[‘Test’]);
And the result: Warning: Undefined array key “Test” in … /index.php on line 34 (that’s where the echo is)
I have been researching about this problem but in vain.
My assumption is an internal problem or maybe the php upgrades?, might be completely wrong.
I don’t see how that would be any safer then just hardcoding them (If you are using them once), or putting them in a config.php file (If you are using them multiple times).
Both cannot be accessed via a browser, and both can be accessed via FTP.