We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • environmentVariables ignored by FastCGI application

    Feb 11, 2015 01:17 AM|geogaphika|LINK

    I need to use an environment variable to configure MapServer (http://mapserver.org/) a C program that can run as a FastCGI application in IIS.

    The code uses the C getenv function to get this variable.

    const char *pszCurlCABundle = NULL;
    pszCurlCABundle = getenv("CURL_CA_BUNDLE");

    I have set the System Environment variable in Windows and rebooted. However the variable is always null. If I run the same program from the command line the environment variable is picked up correctly.

    As I understand it the FastCGI environment differs from the standard one. I have tried to configure this using IIS and applicationHost.config, but again no effect. I've tried the following at applicationHost.config and web.config levels:

        <application fullPath="C:\Mapserver\bin\mapserv.exe">
                <environmentVariable name="CURL_CA_BUNDLE" value="C:\Mapserver\bin\curl\curl-ca-bundle.crt" />

    It seems all environment variables are null including CURL_CA_BUNDLE and path:

      test1 = getenv("Path");
      msDebug("Path=%s\n", test1); // Path=(null) 

    Is this an issue with IIS, and is there anyway to set up the environment so these variables are picked up? I have tried on Windows7 and Windows Server 2008 R2, IIS 7 and IIS 7.5.7600 respectively

    Environment Variables fastcgi