Re: [mapserver-users] MapServer Environment Variables and IIS
Some further details after debugging. I modified mmaphttp.c and recompiled MapServer just to confirm the missing environment variables. // pszCurlCABundle = C:\\MapServer\\bin\\curl\\curl-ca-bundle.crt; // works when hardcoded pszCurlCABundle = getenv(Path); msDebug(Test CURL_CA_BUNDLE=%s\n, pszCurlCABundle); test1 = getenv(Path); msDebug(Path=%s\n, test1); Then run using mapserv the env variables are correct. When run in IIS using FastCGI both appear as null in the log file. [Tue Feb 10 13:54:13 2015].868000 Test CURL_CA_BUNDLE=(null) [Tue Feb 10 13:54:13 2015].868000 Path=(null) getenv is part of the standard C library http://www.codingunit.com/c-reference-stdlib-h-function-getenv So I guess this must be an IIS/FastCGI issue rather than MapServer? Seth On 09/02/2015 21:48, Jeff McKenna wrote: On 2015-02-09 1:03 PM, geographika wrote: Thanks Jeff. The environment variable is definitely set in system variables, and I've rebooted a few times now. It also happens on both a w08r2 server and a Windows 7 machine. I can see it in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment I'm using x64 MapServer, but the environment variables appear in my x64 Python script. I had this working a couple of years ago, and tried to see if anything has changed in the MS source since but no luck. I think I should also be able to set it in the web.config using the following, but also no luck: fastCgi application fullPath=C:\Mapserver\bin\mapserv.exe environmentVariables environmentVariable name=CURL_CA_BUNDLE value=C:\Mapserver\bin\curl\curl-ca-bundle.crt / /environmentVariables /application /fastCgi Regards, Seth I think I may been in your exact shoes once, and it was a problem with the Curl library in the MapServer build (I believe Curl is used for this certification/communication, along with the OpenSSL, but you could clarify this with other developers). I would also test with MS4W to see if you get the same problem. I think you said it used to work with an older MapServer version; I would therefore test on that same server with that same older MapServer version/package again too. Ha, this is how I debug (yes gives you grey hairs ha!). -jeff ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] MapServer Environment Variables and IIS
Mod fcgid on apache has special directives to set environment variables, c.f. FcgidInitialEnv . on iis you hopefully have the same... On Feb 10, 2015 8:18 AM, geographika geograph...@gmail.com wrote: Some further details after debugging. I modified mmaphttp.c and recompiled MapServer just to confirm the missing environment variables. // pszCurlCABundle = C:\\MapServer\\bin\\curl\\curl-ca-bundle.crt; // works when hardcoded pszCurlCABundle = getenv(Path); msDebug(Test CURL_CA_BUNDLE=%s\n, pszCurlCABundle); test1 = getenv(Path); msDebug(Path=%s\n, test1); Then run using mapserv the env variables are correct. When run in IIS using FastCGI both appear as null in the log file. [Tue Feb 10 13:54:13 2015].868000 Test CURL_CA_BUNDLE=(null) [Tue Feb 10 13:54:13 2015].868000 Path=(null) getenv is part of the standard C library http://www.codingunit.com/c- reference-stdlib-h-function-getenv So I guess this must be an IIS/FastCGI issue rather than MapServer? Seth On 09/02/2015 21:48, Jeff McKenna wrote: On 2015-02-09 1:03 PM, geographika wrote: Thanks Jeff. The environment variable is definitely set in system variables, and I've rebooted a few times now. It also happens on both a w08r2 server and a Windows 7 machine. I can see it in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment I'm using x64 MapServer, but the environment variables appear in my x64 Python script. I had this working a couple of years ago, and tried to see if anything has changed in the MS source since but no luck. I think I should also be able to set it in the web.config using the following, but also no luck: fastCgi application fullPath=C:\Mapserver\bin\mapserv.exe environmentVariables environmentVariable name=CURL_CA_BUNDLE value=C:\Mapserver\bin\curl\curl-ca-bundle.crt / /environmentVariables /application /fastCgi Regards, Seth I think I may been in your exact shoes once, and it was a problem with the Curl library in the MapServer build (I believe Curl is used for this certification/communication, along with the OpenSSL, but you could clarify this with other developers). I would also test with MS4W to see if you get the same problem. I think you said it used to work with an older MapServer version; I would therefore test on that same server with that same older MapServer version/package again too. Ha, this is how I debug (yes gives you grey hairs ha!). -jeff ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] MapServer Environment Variables and IIS
Thanks for the reply. It should be possible to set these in IIS in the web.config file as outlined here: http://www.iis.net/configreference/system.webserver/fastcgi/application/environmentvariables fastCgi application fullPath=C:\Mapserver\bin\mapserv.exe environmentVariables environmentVariable name=CURL_CA_BUNDLE value=C:\Mapserver\bin\curl\curl-ca-bundle.crt / /environmentVariables /application /fastCgi handlers add name=MapServerFastCgi path=* verb=* type= modules=FastCgiModule scriptProcessor=C:\Mapserver\bin\mapserv.exe resourceType=Unspecified requireAccess=Script allowPathInfo=false preCondition= responseBufferLimit=4194304 / /handlers http://www.iis.net/configreference/system.webserver/fastcgi/application/environmentvariables However I've tried at all levels (app, web site, server) with no luck. On 10/02/2015 14:22, thomas bonfort wrote: Mod fcgid on apache has special directives to set environment variables, c.f. FcgidInitialEnv . on iis you hopefully have the same... On Feb 10, 2015 8:18 AM, geographika geograph...@gmail.com mailto:geograph...@gmail.com wrote: Some further details after debugging. I modified mmaphttp.c and recompiled MapServer just to confirm the missing environment variables. // pszCurlCABundle = C:\\MapServer\\bin\\curl\\curl-ca-bundle.crt; // works when hardcoded pszCurlCABundle = getenv(Path); msDebug(Test CURL_CA_BUNDLE=%s\n, pszCurlCABundle); test1 = getenv(Path); msDebug(Path=%s\n, test1); Then run using mapserv the env variables are correct. When run in IIS using FastCGI both appear as null in the log file. [Tue Feb 10 13:54:13 2015].868000 Test CURL_CA_BUNDLE=(null) [Tue Feb 10 13:54:13 2015].868000 Path=(null) getenv is part of the standard C library http://www.codingunit.com/c-reference-stdlib-h-function-getenv So I guess this must be an IIS/FastCGI issue rather than MapServer? Seth On 09/02/2015 21:48, Jeff McKenna wrote: On 2015-02-09 1:03 PM, geographika wrote: Thanks Jeff. The environment variable is definitely set in system variables, and I've rebooted a few times now. It also happens on both a w08r2 server and a Windows 7 machine. I can see it in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment I'm using x64 MapServer, but the environment variables appear in my x64 Python script. I had this working a couple of years ago, and tried to see if anything has changed in the MS source since but no luck. I think I should also be able to set it in the web.config using the following, but also no luck: fastCgi application fullPath=C:\Mapserver\bin\mapserv.exe environmentVariables environmentVariable name=CURL_CA_BUNDLE value=C:\Mapserver\bin\curl\curl-ca-bundle.crt / /environmentVariables /application /fastCgi Regards, Seth I think I may been in your exact shoes once, and it was a problem with the Curl library in the MapServer build (I believe Curl is used for this certification/communication, along with the OpenSSL, but you could clarify this with other developers). I would also test with MS4W to see if you get the same problem. I think you said it used to work with an older MapServer version; I would therefore test on that same server with that same older MapServer version/package again too. Ha, this is how I debug (yes gives you grey hairs ha!). -jeff ___ mapserver-users mailing list mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] MapServer Environment Variables and IIS
On 2015-02-09 10:30 AM, geographika wrote: Hi list, There seems to be an issue with running FastCGI under IIS 7.5 and environment variables used by MapServer. I need to point to a curl-ca-bundle.crt file to access a remote WFS server, and it appears this can only be set using an environment variable named CURL_CA_BUNDLE. In brief, if I run the following from the command line: mapserv -nh QUERY_STRING=map=C:\Mapserver\apps\test\test.mapSERVICE=WFSVERSION=1.1.0REQUEST=GetCapabilities My error log contains [Mon Feb 09 14:47:29 2015].66000 HTTP: Starting to prepare HTTP requests. [Mon Feb 09 14:47:29 2015].66000 Using CURL_CA_BUNDLE=curl-ca-bundle.crt If I run http://localhost/mapserver/?map=C:\Mapserver\apps\test\test.mapSERVICE=WFSVERSION=1.1.0REQUEST=GetCapabilities in the browser the Using CURL_CA_BUNDLE line does not appear and my certs are not found. It appears this is not limited to this variable - setting MS_ERRORLOG as a system variable is also ignored. I have checked that the variables are available using a Python script running in IIS. I've also tried setting up custom environment variables for the FastCGI app, played with all sorts of permissions, but no luck. Tamas's blog mentions: The main issue here is that most of the libararies use *getenv *to retrieve the environment setting, which operates only on the data structures accessible to the run-time library (msvcrt) and not on the environment segment created for the process by the operating system. http://blog.gisinternals.com/2010/12/daily-built-binary-packages-for.html However I'm not sure what the workaround here is exactly. This issue appears to have come up before on the list - http://lists.osgeo.org/pipermail/mapserver-users/2014-February/075983.html Any help appreciated. Regards, Seth -- web:http://geographika.co.uk twitter: @geographika MS4W sets that environment variable through an Apache directive; for IIS clients using MS4W, I always make sure to set System (not User) environment variables, and always always reboot the server manually after setting these variables (for some reason, whenever I set this up with MS4W on IIS I have to reboot the client's server for IIS to see them). -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] MapServer Environment Variables and IIS
Thanks Jeff. The environment variable is definitely set in system variables, and I've rebooted a few times now. It also happens on both a w08r2 server and a Windows 7 machine. I can see it in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment I'm using x64 MapServer, but the environment variables appear in my x64 Python script. I had this working a couple of years ago, and tried to see if anything has changed in the MS source since but no luck. I think I should also be able to set it in the web.config using the following, but also no luck: fastCgi application fullPath=C:\Mapserver\bin\mapserv.exe environmentVariables environmentVariable name=CURL_CA_BUNDLE value=C:\Mapserver\bin\curl\curl-ca-bundle.crt / /environmentVariables /application /fastCgi Regards, Seth On 09/02/2015 17:02, Jeff McKenna wrote: On 2015-02-09 10:30 AM, geographika wrote: Hi list, There seems to be an issue with running FastCGI under IIS 7.5 and environment variables used by MapServer. I need to point to a curl-ca-bundle.crt file to access a remote WFS server, and it appears this can only be set using an environment variable named CURL_CA_BUNDLE. In brief, if I run the following from the command line: mapserv -nh QUERY_STRING=map=C:\Mapserver\apps\test\test.mapSERVICE=WFSVERSION=1.1.0REQUEST=GetCapabilities My error log contains [Mon Feb 09 14:47:29 2015].66000 HTTP: Starting to prepare HTTP requests. [Mon Feb 09 14:47:29 2015].66000 Using CURL_CA_BUNDLE=curl-ca-bundle.crt If I run http://localhost/mapserver/?map=C:\Mapserver\apps\test\test.mapSERVICE=WFSVERSION=1.1.0REQUEST=GetCapabilities in the browser the Using CURL_CA_BUNDLE line does not appear and my certs are not found. It appears this is not limited to this variable - setting MS_ERRORLOG as a system variable is also ignored. I have checked that the variables are available using a Python script running in IIS. I've also tried setting up custom environment variables for the FastCGI app, played with all sorts of permissions, but no luck. Tamas's blog mentions: The main issue here is that most of the libararies use *getenv *to retrieve the environment setting, which operates only on the data structures accessible to the run-time library (msvcrt) and not on the environment segment created for the process by the operating system. http://blog.gisinternals.com/2010/12/daily-built-binary-packages-for.html However I'm not sure what the workaround here is exactly. This issue appears to have come up before on the list - http://lists.osgeo.org/pipermail/mapserver-users/2014-February/075983.html Any help appreciated. Regards, Seth -- web:http://geographika.co.uk twitter: @geographika MS4W sets that environment variable through an Apache directive; for IIS clients using MS4W, I always make sure to set System (not User) environment variables, and always always reboot the server manually after setting these variables (for some reason, whenever I set this up with MS4W on IIS I have to reboot the client's server for IIS to see them). -jeff ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] MapServer Environment Variables and IIS
On 2015-02-09 1:03 PM, geographika wrote: Thanks Jeff. The environment variable is definitely set in system variables, and I've rebooted a few times now. It also happens on both a w08r2 server and a Windows 7 machine. I can see it in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment I'm using x64 MapServer, but the environment variables appear in my x64 Python script. I had this working a couple of years ago, and tried to see if anything has changed in the MS source since but no luck. I think I should also be able to set it in the web.config using the following, but also no luck: fastCgi application fullPath=C:\Mapserver\bin\mapserv.exe environmentVariables environmentVariable name=CURL_CA_BUNDLE value=C:\Mapserver\bin\curl\curl-ca-bundle.crt / /environmentVariables /application /fastCgi Regards, Seth I think I may been in your exact shoes once, and it was a problem with the Curl library in the MapServer build (I believe Curl is used for this certification/communication, along with the OpenSSL, but you could clarify this with other developers). I would also test with MS4W to see if you get the same problem. I think you said it used to work with an older MapServer version; I would therefore test on that same server with that same older MapServer version/package again too. Ha, this is how I debug (yes gives you grey hairs ha!). -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] MapServer Environment Variables and IIS
Hi list, There seems to be an issue with running FastCGI under IIS 7.5 and environment variables used by MapServer. I need to point to a curl-ca-bundle.crt file to access a remote WFS server, and it appears this can only be set using an environment variable named CURL_CA_BUNDLE. In brief, if I run the following from the command line: mapserv -nh QUERY_STRING=map=C:\Mapserver\apps\test\test.mapSERVICE=WFSVERSION=1.1.0REQUEST=GetCapabilities My error log contains [Mon Feb 09 14:47:29 2015].66000 HTTP: Starting to prepare HTTP requests. [Mon Feb 09 14:47:29 2015].66000 Using CURL_CA_BUNDLE=curl-ca-bundle.crt If I run http://localhost/mapserver/?map=C:\Mapserver\apps\test\test.mapSERVICE=WFSVERSION=1.1.0REQUEST=GetCapabilities in the browser the Using CURL_CA_BUNDLE line does not appear and my certs are not found. It appears this is not limited to this variable - setting MS_ERRORLOG as a system variable is also ignored. I have checked that the variables are available using a Python script running in IIS. I've also tried setting up custom environment variables for the FastCGI app, played with all sorts of permissions, but no luck. Tamas's blog mentions: The main issue here is that most of the libararies use *getenv *to retrieve the environment setting, which operates only on the data structures accessible to the run-time library (msvcrt) and not on the environment segment created for the process by the operating system. http://blog.gisinternals.com/2010/12/daily-built-binary-packages-for.html However I'm not sure what the workaround here is exactly. This issue appears to have come up before on the list - http://lists.osgeo.org/pipermail/mapserver-users/2014-February/075983.html Any help appreciated. Regards, Seth -- web:http://geographika.co.uk twitter: @geographika ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users