Bug report #16799

qgis server installation and configuration - End of script output before headers: qgis_mapserv.fcgi.exe

Added by atilio françois about 3 years ago. Updated over 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:QGIS Server
Affected QGIS version:2.14.11 Regression?:No
Operating System:windows 10 - windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:No Copied to github as #:24698

Description

I installed (on Windows 10 but also on windows 7 with exactly the same result) Apache/PHP with Stackbuilder,and then QGis Server 64bits with osgeo4w-setup-x86_64.exe

After install I modified apache httpd.conf following http://level2.si/2015/12/qgis-server-on-windows-10/ instructions:
ScriptAlias /cgi-bin/ "c:/OSGeo4W64/apps/qgis-ltr/bin/"

<Directory "c:\OSGeo4W64\apps\qgis-ltr\bin">
SetHandler cgi-script
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>

AddHandler cgi-script .cgi .pl .exe

AcceptFilter http none
AcceptFilter https none

SetEnv GDAL_DATA "C:\OSGeo4W64\share\gdal"
SetEnv QGIS_AUTH_DB_DIR_PATH "C:\OSGeo4W64\apps\qgis-ltr\resources"
SetEnv PYTHONHOME "C:\OSGeo4W64\apps\Python27"
SetEnv PATH "C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis-ltr\bin;C:\OSGeo4W64\apps\grass\grass-grassversion\bin;C:\OSGeo4W64\apps\grass\grass-grassversion\lib;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem”
SetEnv QGIS_PREFIX_PATH "C:\OSGeo4W64\apps\qgis-ltr"
SetEnv QT_PLUGIN_PATH "C:\OSGeo4W64\apps\qgis-ltr\qtplugins;C:\OSGeo4W64\apps\qt4\plugins"

I restart apache service and try to test test the install with the url

http://localhost:8081/cgi-bin/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

I get the next message in my browser:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

In the apache log I get the next line:

Wed Jul 05 19:11:52.792509 2017] [cgi:error] [pid 3276:tid 804] [client 127.0.0.1:27613] End of script output before headers: qgis_mapserv.fcgi.exe

I tried a few things founds in the web (copying dll and .py to other directories) but the result is always the same error message

History

#1 Updated by Giovanni Manghi almost 3 years ago

  • Status changed from Open to Feedback

On Windows it not obvious, but you must install also QGIS Desktop (same version of the server of course), did you? Another issue I have seen in the past is that despite being possible to install with osgeo4w multiple qgis server versions (say LTR and 2.18) you really must have just 1 installed to not get errors. Please check and report back.

#2 Updated by Giovanni Manghi almost 3 years ago

also installing the necessary components from osgeo4w (which is the official way) it works as expected:

http://localhost/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

<WMS_Capabilities version="1.3.0" xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd http://www.qgis.org/wms http://localhost/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&REQUEST=GetSchemaExtension"><Service><Name>WMS</Name><!-- Human-readable title for pick lists -->
<Title>QGIS mapserver</Title><!-- Narrative description providing additional information
--><Abstract>A WMS service with QGIS mapserver</Abstract><KeywordList><Keyword>QGIS mapserver</Keyword></KeywordList><!-- Top-level web address of service or service provider. See also OnlineResource
elements under <DCPType>.
--><OnlineResource xlink:type="simple" xlink:href="http://www.sourcepole.ch/"/><!-- Contact information -->
<ContactInformation><ContactPersonPrimary><ContactPerson>Marco Hugentobler</ContactPerson><ContactOrganization>Sourcepole AG</ContactOrganization></ContactPersonPrimary><ContactAddress><AddressType>postal</AddressType><Address>Weberstrasse 5</Address><City>Zürich</City><StateOrProvince>ZH</StateOrProvince><PostCode>8004</PostCode><Country>SWITZERLAND</Country></ContactAddress><ContactVoiceTelephone/><ContactElectronicMailAddress>[email protected]</ContactElectronicMailAddress></ContactInformation><!-- Fees or access constraints imposed. -->
<Fees>none</Fees><AccessConstraints>none</AccessConstraints><LayerLimit>99</LayerLimit></Service><Capability><Request><GetCapabilities><Format>text/xml</Format><DCPType><HTTP><Get><OnlineResource xlink:type="simple" xlink:href="http://localhost/qgis/qgis_mapserv.fcgi.exe?"/></Get></HTTP></DCPType></GetCapabilities><GetMap><Format>image/jpeg</Format><Format>image/png</Format><Format>image/png; mode=16bit</Format><Format>image/png; mode=8bit</Format><Format>image/png; mode=1bit</Format><Format>application/dxf</Format><DCPType><HTTP><Get><OnlineResource xlink:type="simple" xlink:href="http://localhost/qgis/qgis_mapserv.fcgi.exe?"/></Get></HTTP></DCPType></GetMap><GetFeatureInfo><Format>text/plain</Format><Format>text/html</Format><Format>text/xml</Format><Format>application/vnd.ogc.gml</Format><Format>application/vnd.ogc.gml/3.1.1</Format><DCPType><HTTP><Get><OnlineResource xlink:type="simple" xlink:href="http://localhost/qgis/qgis_mapserv.fcgi.exe?"/></Get></HTTP></DCPType></GetFeatureInfo><sld:GetLegendGraphic><Format>image/jpeg</Format><Format>image/png</Format><DCPType><HTTP><Get><OnlineResource xlink:type="simple" xlink:href="http://localhost/qgis/qgis_mapserv.fcgi.exe?"/></Get></HTTP></DCPType></sld:GetLegendGraphic><sld:DescribeLayer><Format>text/xml</Format><DCPType><HTTP><Get><OnlineResource xlink:type="simple" xlink:href="http://localhost/qgis/qgis_mapserv.fcgi.exe?"/></Get></HTTP></DCPType></sld:DescribeLayer><qgs:GetStyles><Format>text/xml</Format><DCPType><HTTP><Get><OnlineResource xlink:type="simple" xlink:href="http://localhost/qgis/qgis_mapserv.fcgi.exe?"/></Get></HTTP></DCPType></qgs:GetStyles></Request><Exception><Format>XML</Format></Exception><sld:UserDefinedSymbolization RemoteWFS="0" RemoteWCS="0" InlineFeature="0" UserStyle="1" SupportSLD="1" UserLayer="0"/><Layer queryable="1"><Name>wfslayer</Name></Layer></Capability></WMS_Capabilities>

#3 Updated by Giovanni Manghi almost 3 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed

Closing for lack of feedback, please reopen if necessary.

#4 Updated by Nino Formica over 2 years ago

I have the same problem with QGIS server 2.18.16 installed on Ubuntu 16. When I call:
http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
I get (on the browser):500 internal server error

This is Apache 2.4 error.log:
Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.
Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable.
[Thu Jan 25 21:35:31.743355 2018] [fcgid:warn] [pid 3376:tid 139896667043584] [client 127.0.0.1:49866] mod_fcgid: read data timeout in 40 seconds
[Thu Jan 25 21:35:31.743490 2018] [core:error] [pid 3376:tid 139896667043584] [client 127.0.0.1:49866] End of script output before headers: qgis_mapserv.fcgi

Also available in: Atom PDF