Amazon AWS have an official template for WordPress configuration file that uses the $_SERVER['SOME_CUSTOM_SYSTEM_VAR']
syntax to set environment variables values to the application. And I have realized that the key in $_SERVER is always equals to a Linux environment variable, that I conveniently can setup in the web console. It would mean that I could also set the same custom variables in my development environment and in deployment make no changes in the code in terms of variables adjustments and neither worry about some configuration file that can be wrongly handled in the deployment process.
But actually, in my development environments the things almost works like this. I an working in a Laravel application, and the $_SERVER['SOME_CUSTOM_SYSTEM_VAR']
, as those related to the databases connection works file in the console commands. But, when running the application in a PHP server for development, those same variables does not works, and I receive the Undefined index
error.
How does I set my local development environment, so that the local PHP server can understood the $_SERVER['SOME_CUSTOM_SYSTEM_VAR']
, fetching variables from the operational system?