Apache Environment Variables in PHP

Set up custom environment variables in Apache virtual hosts file so that they can be accessed in PHP. Open your virtual hosts file and use the following SetEnv directive along with your own variable name:

SetEnv ENV_VAR_NAME value

Reload Apache, then you can access the variable from the $_SERVER environment information array, for example:

$_SERVER['ENV_VAR_NAME']