Bug report #17016

Qgis server/qgis web client php search problems

Added by Ivan D'Ortenzio over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:QGIS Server
Affected QGIS version:2.18.10 Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:24915

Description

I have configured a localhost qgiserver/qgisclient in my windows 10 pc with Apache/2.4.27 (Win64) and php7 loaded in httpd.conf:

LoadModule php7_module "C:\Apache_qgiserver\php_mod\php7apache2_4.dll"
AddHandler php7-script php
DirectoryIndex index.html index.php
AddType text/html php
PhpIniDir "C:\Apache_qgiserver\php_mod"

The Web client works fine but I cannot configure php search box... I've created a sample project named "prova.qgs" in \htdocs\QGIS-Web-Client\projects with a postgis layer inside named "italia". Then I modified GlobalOptions.js to include search box:
// PHP based search scripts (postgis layers only)
var searchBoxQueryURL = '../php/search.php?map=' + project_map;
var searchBoxGetGeomURL = '../php/search_geom.php?map=' + project_map;

Then I set up the config.php file as follows:

/************************************** * search configuration
*/
// Configuration for searchable layers
$searchlayers_config = array(
// Key is layer name
'italia' => array(
// SQL for text search: where to search
'search_column' => 'nome'
)
);

// Default search tables
define('DEFAULT_SEARCH_LAYERS', 'italia');

but the search box doesn't work and I receive an error:

Internal server error (QGIS Client)
db error: SQLSTATE08006 [7] FATALE: autenticazione con password fallita per l'utente "'postgres'"

this is the query url: http://localhost/php/search.php?map=C:/Apache_qgiserver/htdocs/QGIS-Web-Client/projects/prova.qgs&searchtables=&query=sicilia&cb=stcCallback1001

History

#1 Updated by Tudor Bărăscu over 7 years ago

I haven't played around with the php search but the error seems obvious (wrong password for user postgres).
You could setup the db to temporarily trust connections from your ip just to be sure.

#2 Updated by Ivan D'Ortenzio over 7 years ago

Tudor Bărăscu wrote:

I haven't played around with the php search but the error seems obvious (wrong password for user postgres).
You could setup the db to temporarily trust connections from your ip just to be sure.

I resolved my problem... but I modified connection string parameters like host,port,dbname,user and password manually in htdocs\QGIS-Web-Client\site\php\Helpers.php. This is because the $ds_parms['user'] return the username as'postgres' and not without quotes.

#3 Updated by Giovanni Manghi over 7 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

I resolved my problem...

good. This was also the wrong bug tracker where to report an issue about QWC.

Also available in: Atom PDF