Goal was to setup latest QGIS Server LTR (2.14.x) on Windows 10 for use with Extended QGIS Web Client (EQWC). Main components needed for this are (minimum required versions):
- Apache 2.4
- PHP 5.5
- PostgresSQL 9.4
- QGIS Server LTR 2.14
Apache and PHP
Download XAMPP distribution (difference is only PHP version). For this setup we will use latest PHP and remove other options as only installing Apache and PHP.
Test for Apache and PHP
PostgreSQL
Install desired PG version with PostGreSQL install.
QGIS Server LTR 2.14
Download 64 bit OSGeo4W installer . Choose advanced installation, from web and then select QGIS Server LTR from Web part and qscintilla from libs. Install QGIS Desktop LTR if you want also to prepare projects on this machine.
Apache configuration
Edit httpd.conf
file. In case of XAMPP you get Control Panel where it is really simple to do that.
ScriptAlias
change line:
ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"
to:
ScriptAlias /cgi-bin/ "c:/OSGeo4W64/apps/qgis-ltr/bin/"
QGIS Server configuration
change part:
<Directory "C:/xampp/cgi-bin"
AllowOverride None
Options None
Require all granted
</Directory>
to:
<Directory "c:/OSGeo4W64/apps/qgis-ltr/bin">
SetHandler cgi-script
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>
Cgi handler
change line:
AddHandler cgi-script .cgi .pl .asp
to:
AddHandler cgi-script .cgi .pl .exe
Variables
insert at bottom of http.conf:
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"
That completes Apache configuration.
Test
Restart Apache server (from XAMPP Control Panel) and open a GetCapabilities request to QGIS Server
http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
You should receive standard WMS Capabilities XML response from QGIS Server.
Extra setup for Extended QGIS Web Client
Add Rewrite rules in httpd.conf
RewriteEngine On
RewriteRule ^/proxy/(.+)$ /gisapp/admin/qgisproxy.php?map=$1.qgs [QSA,PT]
RewriteRule ^/gisapp/([^\.]+)$ /gisapp/index.php [PT]
Edit php.ini, enable pdo connection to postgres:
;extension=php_pdo_pgsql.dll
to
extension=php_pdo_pgsql.dll
Add GDAL_DATA system variable
Open Control Panel and under System and Advanced System settings click on Environment variables and add new System variable GDAL_DATA with value of your gdal path from OSGeo installation (for example: C:\OSGeo4W64\share\gdal).
This is needed for exporting data.
Restart Apache server. To finish setup of Extended QGIS Web Client go to GitHub repository and Wiki pages .
Everyone interested in this I’m informing that post is updated and that it is working now with QGIS Server 2.14 under Windows!
Hey mate, thanks very much. Been struggling with the installation half a day using other tutorials.
Cheers!
Hi,
I’m glad it worked for you.
hello Uros!
I’ve had your EQWC installed and working on my desktop but now I want to move it to a server.
So… I installed QGIS 2.18.3 with QGIS Server 2.18.3 there. I think I’ve set everything well because gisapp client is loading, it wants me to login to project but then even helloworld project isn’t loading. It only shows blank white screen.
Is it working ONLY with QGIS Server 2.14 LTR?
Regards
he wrote:
“Uroš Preložnik| 2017-01-20 at 15:06
Reply
Everyone interested in this I’m informing that post is updated and that it is working now with QGIS Server 2.14 under Windows!”
so i used 2.14. Are you from Poland Tomasz?
Yes, I’m from Poland. Currently I’m giving it a last try to get it working on QGIS Server 2.18.6. If it won’t work I’ll try with 2.14 LTR.
Hi,
I’m guessing here, what if there is a file system permission problem for Apache to Access those files on disk E. Check permission of this file and folder in file system (right button, Properties and Security). I have SYSTEM and Administrators with Full Control and Authenticated users with Read/Write and Users with Read and it Works.
Its’ hard to say without details, but looks like Apache configuration is not set up (Rewrite module). Take a look at last part of this post: Extra setup for Extended QGIS Web Client.
Also since you have Apache on 8081 did you change it correctly in settings.php?
regards,
Uroš
Excellent post, it works for me, I’m a student from Barcelona. Grettings
Thanks, I’m glad it helped you. Best regards,
Uroš
Everything worked very well. I had to restart the computer to update the modifications in the httpd.conf. Thank you very much.
Greetings from A Coruña -Spain
hi uros. the best post around the web about qgis server, thank you. i have a question maybe you can help me with that. i want to get hydrology layers from this site –> geodata.ormansu.gov.tr i saw wms/wfs under the tool button, so i began to research about it. installed last version of qqis, now installed qgis server thanks to you. so, do you think you can help me with that? any tips would be wonderful. Thanks again!
Hi, thanks a lot for these well-done instructions. It worked like a charm.
Hi Uros! This instruction was the first working one för Windows Server, and helped me tremendously. Have you by any chance managed to install QGIS Server 3.0 in the same way? It fails for me, and I cannot figure out what has changed.
Hi Mats,
I just went through and it works. You have to change qgis-ltr to qgis in Apache part and different is also variables part. Just post this update, look here
qgis-server-3-0-on-windows-10
Hello, any help to install lizmap via xampp? Thank you!
Sorry, don’t have experience with LizMap. I suggest you contact directly 3Liz.
I followed the guide well. qgis server responds correctly. but the gisapp application returns a page
Object not found!
The requested URL could not be found on this server. If you typed the URL by hand, please check the spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
geosphere.ddns.net
Apache / 2.4.33 (Win32) OpenSSL / 1.1.0h PHP / 7.2.5
is ther any reason
Must be something with Apache configuration. Looks like rewrite rules are missing.
I try to install QGIS 2.18.21 (Desktop and Server) on an existing Apache (2.4.33 32Bit) running on Windows Server 2012 R2. Do I need to install QGIS 32Bit (complinat witht the Apache Version) or should I install the 64Bit-Version?
Have to add the following log-infos as QGISServer crashes when trying to get a response from http://localhost/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities…
Name der fehlerhaften Anwendung: qgis_mapserv.fcgi.exe, Version: 0.0.0.0, Zeitstempel: 0x5b2d7e43
Name des fehlerhaften Moduls: Qt5Core.dll, Version: 6.3.9600.18895, Zeitstempel: 0x5a4b127e
Ausnahmecode: 0xc0000135
Fehleroffset: 0x0009d4e2
Pfad der fehlerhaften Anwendung: D:\webanwendungen\qgis\apps\qgis\bin\qgis_mapserv.fcgi.exe
Pfad des fehlerhaften Moduls: Qt5Core
Any idea? Is is a 32/64Bit- issue?
Error is related to wrong paths defined in Variables part. If you installed QGIS in custom folder, you have to modify paths so that they are valid. Looks like they are not now:
D:\webanwendungen\qgis\apps in your case and C:\OSGeo4W64\apps in post above
64bit is recommended, although you have 32bit Apache, because 64bit version is without older versions of Apache, PHP.