<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>yes - Apache confs are sometimes a mystery ...</p>
<p>Thanks for checking.</p>
<p>Andreas</p>
<p>On 2015-11-19 14:10, kimaidou wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div>
<div>
<div>I just tested, and the file<span> /etc/apache2/mods-enabled/env.conf  with<br /></span> <span>SetEnv PGSYSCONFDIR "/etc"<br /><br /></span></div>
<span>is indeed important. Commenting this line would lead to no connection possible by QGIS Server, even if the env variable is correctly set in fcgid.conf.<br /><br /></span></div>
<span>This is the first time I see this behaviour (fcgid.conf not setting properly an env variable)<br /><br /></span></div>
<span>Michaël<br /></span></div>
<div class="gmail_extra"><br />
<div class="gmail_quote">2015-11-19 14:03 GMT+01:00 kimaidou <span><<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>></span>:<br />
<blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">
<div dir="ltr">
<div>
<div>Hi Andreas,<br /><br /></div>
It worked like a charm with your exact configuration.<br /><br /></div>
<div>I will remove the env.conf file to see if it still works without this conf. If so, this would mean the pg_service.conf file situated in /etc/postgresql/ could not be read. Probably wrong permissions on the folder /etc/postgresql.<br /><br /></div>
<div>Thanks again for your help<br /><br /></div>
<div>I add a todo to remember adding this in QGIS Server documentation.<br /><br /></div>
<div>Regards</div>
<div>Michaël</div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br />
<div class="gmail_quote">2015-11-19 13:59 GMT+01:00 Neumann, Andreas <span><<a href="mailto:a.neumann@carto.net">a.neumann@carto.net</a>></span>:<br />
<blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif;">
<p>Hi,</p>
<p>Here are the properties of my pg_service.conf file:</p>
<p><span>-rw-r--r-- 1 root root 809 Aug 13  2014 /etc/pg_service.conf<span><span style="color: #888888;"><br /></span></span></span></p>
<p>Andreas</p>
<div>
<div>
<p>On 2015-11-19 13:52, kimaidou wrote:</p>
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">
<div dir="ltr">
<div>
<div>Thanks Andreas for your help.<br /><br /></div>
I also think fcgid.conf is the "winner", but I will try your configuration ( move pg_service.conf to /etc/ and add the setenv in Apache env.conf ).</div>
<div>Could you please give me the result of <br /><br />ls -lh /etc/pg_service.conf<br /><br />command, so that I completely mimic your configuration ?<br /><br /></div>
<div>Cheers,</div>
<div>Michaël</div>
</div>
<div class="gmail_extra"><br />
<div class="gmail_quote">2015-11-19 13:00 GMT+01:00 Neumann, Andreas <span><<a href="mailto:a.neumann@carto.net">a.neumann@carto.net</a>></span>:<br />
<blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;">
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif;">
<p>Hi <span>Michaël,</span></p>
<p><span>This works for me.</span></p>
<p><span>My pg_service.conf file is at <span>/etc/pg_service.conf<br /></span></span></p>
<p><span>And in the Apache configuration it is specified in two files:</span></p>
<p><span>/etc/apache2/mods-enabled/env.conf :<br /></span></p>
<p><span>SetEnv PGSYSCONFDIR "/etc"<br /></span></p>
<p><span>and in </span></p>
<p><span><span>/etc/apache2/mods-enabled/fcgid.conf</span></span></p>
<p><span>FcgidInitialEnv PGSYSCONFDIR "/etc"<br /></span></p>
<p><span>I am not sure which one is really used or has precedence - I suspect it is the fcgid.conf file.</span></p>
<p><span>Hope you get this working,</span></p>
<p><span>Andreas</span></p>
<div>
<div>
<p>On 2015-11-19 12:17, kimaidou wrote:</p>
</div>
</div>
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">
<div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>Hi all<br /><br /></div>
I have installed QGIS Server in one server (called "map") and PostGreSQL on another (called "pg" ), both on Ubuntu Server 14.04</div>
I would like to access to database only with PostGreSQL services, so in the map server, I did the following steps:<br /><br /></div>
* Create a folder /etc/postgresql<br />* Create a file /etc/postgresql/pg_service.conf  with some credentials<br />* Install postgresql-client to be able to use psql</div>
<div>* Add a environment variable PGSYSCONFDIR  and export it (plus add it in /etc/environment ). Variable : PGSYSCONFDIR=/etc/postgresq'l</div>
<div>* Test via psql "service=myservice"  -> I can connect to the database and get data<br /><br /></div>
<div>When I ask QGIS Server for the GetCapabilities, the layers configured with this service cannot be added. I get the error : "Service myservice not found"<br /><br /></div>
<div>So I added the following line in the fcgid.conf file to explicitely tell Apache (and QGIS Server) to use this value.</div>
<div>FcgidInitialEnv PGSYSCONFDIR "/etc/postgresql"<br /><br /></div>
<div>But nothing works. I even tried to chmod and chown the service file and folder to let Apache user www-data to read it. I also tried with a quick and dirty chmod 777 , with no luck.<br /><br /></div>
<div>Has anyone some experience in setting up a Server with no postgresql installed locally, and use the pg_service.conf file with QGIS Server ?<br /><br /></div>
<div>Thanks a lot for any clue</div>
<div>Michaël</div>
</div>
</div>
</div>
<div style="margin: 0; padding: 0; font-family: monospace;">_______________________________________________<br /> Qgis-developer mailing list<br /><a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br /> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br /> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div>
</blockquote>
<p> </p>
<div> </div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<p> </p>
<div> </div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
<p> </p>
<div> </div>
</body></html>