I am attempting to get QGIS Server installed on a Windows 2012 R2 Server. After following the information at the https://anitagraser.com/2012/04/06/qgis-server-on-windows7-step-by-step/, and looking at other resources on StackExchange and the official QGIS Server Wiki, YouTube, and everywhere else I could find, I have managed to almost get it working.

When I attempt to access http:///qgis/qgis_mapserv.fcgi.exe? I receive a 500 Internal Server Error. I also receive in the Apache error logs:

(OS 109)The pipe has been ended.  : mod_fcgid: get overlap result error
Premature end of script headers: qgis_mapserv.fcgi.exe

When I run the qgis_mapserv.fcgi.exe binary directly, I see this output:

 QFSFileEngine::open: No file name specified 
 Content-Length: 206
 Content-Type: text/xml; charset=utf-8

 <ServiceExceptionReport version="1.3.0"
 xmlns="http://www.opengis.net/ogc">  <ServiceException code="Service
 configuration error">Service unknown or unsupported</ServiceException>

Now I think the cause is the first line, since the server is recognizing that it's not a valid HTTP header and hence terminating the script, but I can't figure out the cause or what I can do to make it go away.

My httpd_qgis.conf file looks like this:

LoadModule fcgid_module modules/mod_fcgid.so

DefaultInitEnv PATH "C:\OSGeo4W\bin;C:\OSGeo4W\apps\qgis\bin;C:\OSGeo4W\apps\grass\grass-@grassversion@\bin;C:\OSGeo4W\apps\grass\grass-@grassversion@\lib;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
DefaultInitEnv QGIS_PREFIX_PATH "C:\OSGeo4W\apps\qgis"
DefaultInitEnv QT_PLUGIN_PATH "C:\OSGeo4W\apps\qgis\qtplugins;C:\OSGeo4W\apps\qt4\plugins"
DefaultInitEnv TEMP "C:\Users\C_Young\AppData\Local\Temp"
DefaultInitEnv PYTHONHOME "C:\OSGeo4W\apps\Python27"

#DefaultInitEnv PYTHONPATH "C:\OsGeo4W\apps\qgis\.\python;C:\OsGeo4W\apps\qgis\.\python\plugins;C:\OsGeo4W\apps\Python27\DLLs;C:\OsGeo4W\apps\Python27\lib;C:\OsGeo4W\bin;C:\OsGeo4W\apps\Python27;C:\OsGeo4W\apps\Python27\lib\site-packages"

#DefaultInitEnv GDAL_DATA "C:\OSGeo4W\share\gdal"
DefaultInitEnv GDAL_DRIVER_PATH "C:\OSGeo4W\bin;C:\OSGeo4W\bin\gdalplugins"

#DefaultInitEnv PROJ_LIB "C:\OSGeo4W\share\proj"

#DefaultInitEnv VSI_CACHE TRUE
#DefaultInitEnv VSI_CACHE_SIZE 1000000

Alias /qgis/ C:\OSGeo4W/apps/qgis/bin/

<Directory "C:\OSGeo4W/apps/qgis/bin/">
    SetHandler fcgid-script
    Options ExecCGI
    Order allow,deny
    Allow from all

As you can see, there's a number of other commented out directives. I've tried everything I can find relative to OsGeo4W, and QGIS Server, but still to no avail. If I could just find a way to suppress the first line, I'd be happy at this point.


Looking at the use of Alias in my Apache.conf files on Windows, I think the following line in your code might be wrong.

Alias /qgis/ C:\OSGeo4W/apps/qgis/bin/

I would have it as:

Alias /qgis/ "C:/OSGeo4W/apps/qgis/bin/"

Your conf file looks, fine. Now there is a little thing where you have to copy the qgis_mapserv.fcgi.exe and rename your new copy to qgis_mapserv.fcgi.

The thing is that apache is mostly ran on Linux based machines and when we switch to windows most of apps and programs have .exe. You told apache in your conf file, that there will be a fcid-script in the directory C:\OSGeo4W/apps/qgis/bin/. Apache goes there and only finds .exe and calls you a liar with a error 500.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.