I have an environmental variable defined in Windows environmental variables -> user variables
$MY_VARIABLE=mypath
and in php I tried to access it like below
<?php
echo $_ENV["MY_VARIABLE"];
but it doesn’t print anything. Am I missing something here or is it that PHP doesn’t have access to user environmental variables ?
EDIT: I am running PHP as an Apache module (important info that I left out initially).
You
$_ENVis empty because of variables_order settings in PHPEdit your PHP.INI
Change
To
It should work by now if it does not try using
.htaccessto achieve thisAdd the following to your
.htaccessYou can get it via PHP