PHP IIS10 & System Environment Variables

  environment-variables, iis-10, php

OK, I’m pulling my hair out here. I need to access the environment variables from my PHP code through an IIS 10 install.

When I look at $_ENV superglobal it’s empty. When I try to access a system environment variable using getenv() (which I’m pretty sure accesses the superglobal anyway) it comes back blank.

We have tried adding EnvironmentVariables to the ApplicationPool section of the applicationHost.config file but again it comes back blank.

Has anyone run into this? Can anyone advise how to fix this? Note that we are NOT loading the user profile on the ApplicationPool because of other permission related issues – don’t know if that helps or not. Saw it mentioned elsewhere.

Any help would be appreciated.

Source: Ask PHP