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

environmentVariables ignored by FastCGI application [Answered]RSS

1 reply

Last post Feb 12, 2015 04:03 AM by Fei Han - MSFT

  • 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

  • Re: environmentVariables ignored by FastCGI application

    Feb 12, 2015 04:03 AM|Fei Han - MSFT|LINK

    Hi geogaphika,

    Thanks for your post.

    Here is a similar issue, you could refer to Marek R’s reply.

    Best Regards,

    Fei Han

    Environment Variables fastcgi