TransWikia.com

Installing QGIS Server - qgis_mapserv.fcgi returns error

Geographic Information Systems Asked by user1186533 on July 2, 2021

I am installing QGIS Server on Ubuntu 20.04 (focal)

Docs indicate one should run usr/lib/cgi-bin/qgis_mapserv.fcgi and expect:

QFSFileEngine::open: No file name specified
Warning 1: Unable to find driver ECW 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.
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.
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>
</ServiceExceptionReport>

But I get:

Application path not initialized
Application path not initialized
Warning 1: Unable to find driver ECW 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.
"Loading native module /usr/lib/qgis/server/libdummy.so"
"Loading native module /usr/lib/qgis/server/liblandingpage.so"
"Loading native module /usr/lib/qgis/server/libwcs.so"
"Loading native module /usr/lib/qgis/server/libwfs.so"
"Loading native module /usr/lib/qgis/server/libwfs3.so"
"Loading native module /usr/lib/qgis/server/libwms.so"
"Loading native module /usr/lib/qgis/server/libwmts.so"
QFSFileEngine::open: No file name specified
Content-Length: 102
Content-Type: application/json
Server:  QGIS FCGI server - QGIS version 3.16.1-Hannover
Status:  400

[{"code":"Bad request error","description":"Requested URI does not match any registered API handler"}]

The commands I have entered into a fresh Ubuntu 20.04 image are:

sudo dpkg --remove-architecture i386
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F7E06F06199EF2F2
gpg --export --armor  F7E06F06199EF2F2  | sudo apt-key add -
sudo add-apt-repository "deb https://qgis.org/debian focal main"
sudo apt update
sudo apt-get install python-qgis qgis-server libapache2-mod-fcgid
sudo apt autoremove

One Answer

I'm seeing the same problem, but this might not be an error, rather the docs might need updating for QGIS 3.16.x.

the source code for qgis_map_serv.cpp immediately drops into a loop where the first thing that happens is a call to fcgi_accept(), which apparently will return once and then return -1 (see here), which allows the loop to run once and then return. since there is no active http session, the default response is going to be the 400 code with the "Bad request" message:

this is the while loop in qgis_map_serv.cpp:

 // Starts FCGI loop                                                                                                                                                                                           
 while ( fcgi_accept() >= 0 )
  {
  QgsFcgiServerRequest  request;
  QgsFcgiServerResponse response( request.method() );
  if ( ! request.hasError() )
  {
    server.handleRequest( request, response );
  }
  else
  {
    response.sendError( 400, "Bad request" );
  }
}
app.exitQgis();
return 0;

Answered by rdamus on July 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP