QGIS-Version 2.14.5 LTR, QGIS Server running on Windows 2008 R2

I encounter a '500 Internal Server error' when using the url http://localhost/qgis-ltr/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&map=flst_ster.qgs

My httpd_qgis-ltr.conf looks like this:

LoadModule fcgid_module modules/mod_fcgid.so

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

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

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

I tried to replace (as suggested in various sources) to replace fcgid by cgi but this causes the same error and an additional Premature end of script headers: qgis_mapserv.fcgi.exe in the apache error.log

I remember getting this to work with 2.8.9.LTR (here I HAD TO replace fcgid by cgi) so have I missed any changes? What might have gone wrong here?

  • 1
    Are your paths C:\OSGeo4W\/apps/qgis-ltr/bin/' correct shouldn't they be C:\OSGeo4W\apps\qgis-ltr\bin` or C:/OSGeo4W/apps/qgis-ltr/bin/ ? – nmtoken Aug 12 '16 at 9:58
  • Didn't change these because they are generated automatically during installation, but your guess makes sense. But using ` in the path causes an error when trying to start apache service. Using /` in these paths lets apache service start normally, but the same 500 internal server error. Even tried to replace the // by / in the SetEnv PATH... but no effect. Same 500... – Jochen Schwarze Aug 15 '16 at 7:22
  • Hint: QGIS Server runs on Win 2008 R2, I added this info in the question. – Jochen Schwarze Aug 15 '16 at 7:23
  • 1
    the ` in my comment is a syntax error in the comment ~ you can use ` to start and end syntax highlighting. It was just a comment on the slashes. – nmtoken Aug 15 '16 at 9:03
  • Do the Apache logs give you any error message? Does Apache know where to read the httpd_qgis-ltr.conf file? – nmtoken Aug 15 '16 at 9:07

Applying some modifications to the httpd_qgis-ltr.conf according to the suggestions of @patrick-chapuis in his answer to QGIS Server 2.8 on Windows Server 2012 solved this issue. As not being an apache expert, I can't say why this works, but it does.

My httpd_qgis-ltr.conf now looks like this:

LoadModule fcgid_module modules/mod_fcgid.so

FcgidInitialEnv PATH "C:\OSGeo4W\bin;C:\OSGeo4W\apps\qgis-ltr\bin;C:\OSGeo4W\apps\grass\grass-@grassversion@\bin;C:\OSGeo4W\apps\grass\grass-@grassversion@\lib;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
FcgidInitialEnv QT_PLUGIN_PATH "C:\OSGeo4W\apps\qgis-ltr\qtplugins;C:\OSGeo4W\apps\qt4\plugins"
FcgidInitialEnv PYTHONHOME "C:\OSGeo4W\apps\Python27"
FcgidInitialEnv PYTHONPATH "C:\OSGeo4W\apps\qgis-ltr\python"

SetEnvIf Request_URI ^/qgis-ltr QGIS_PREFIX_PATH "C:\OSGeo4W\apps\qgis-ltr"
SetEnvIf Request_URI ^/qgis-ltr TEMP "C:\Temp"

SetEnvIf Request_URI ^/qgis GDAL_DATA "C:\OSGeo4W\share\gdal"
SetEnvIf Request_URI ^/qgis GDAL_DRIVER_PATH "C:\OSGeo4W\bin"
SetEnvIf Request_URI ^/qgis PDAL_DRIVER_PATH "C:\OSGeo4W\bin"
SetEnvIf Request_URI ^/qgis GDAL_SKIP "JP2ECW"
SetEnvIf Request_URI ^/qgis PROJ_LIB "C:\OSGeo4W\share\proj"

Alias /qgis-ltr/ C:/OSGeo4W/apps/qgis-ltr/bin/

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

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.