qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.39k stars 2.98k forks source link

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

Closed qgib closed 7 years ago

qgib commented 7 years ago

Author Name: atilio françois (atilio françois) Original Redmine Issue: 16799 Affected QGIS version: 2.14.11 Redmine category:qgis_server


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

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 admin@example.com 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

qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


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.


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


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

QGIS mapserverA WMS service with QGIS mapserverQGIS mapserver Marco HugentoblerSourcepole AGpostal
Weberstrasse 5
ZürichZH8004SWITZERLAND
marco.hugentobler@sourcepole.ch
nonenone99text/xmlimage/jpegimage/pngimage/png; mode=16bitimage/png; mode=8bitimage/png; mode=1bitapplication/dxftext/plaintext/htmltext/xmlapplication/vnd.ogc.gmlapplication/vnd.ogc.gml/3.1.1image/jpegimage/pngtext/xmltext/xmlXMLwfslayer@
qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


Closing for lack of feedback, please reopen if necessary.


qgib commented 6 years ago

Author Name: Nino Formica (Nino Formica)


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

jgrocha commented 5 years ago

Just for the record, I've got the same error on Apache log:

[Wed Jul 03 17:19:42.033792 2019] [fcgid:warn] [pid 18495] (104)Connection reset by peer: [client 188.82.64.125:8759] mod_fcgid: error reading data from FastCGI server
[Wed Jul 03 17:19:42.033856 2019] [core:error] [pid 18495] [client 188.82.64.125:8759] End of script output before headers: qgis_mapserv.fcgi

The problem was solved as soon as I've installed the X server (the xvfb).