<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<br></div><div>Michaël<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-19 13:59 GMT+01:00 Neumann, Andreas <span dir="ltr"><<a href="mailto:a.neumann@carto.net" target="_blank">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 class="HOEnZb"><font color="#888888"><br></font></span></span></p><span class="HOEnZb"><font color="#888888">
<p>Andreas</p></font></span><div><div class="h5">
<p>On 2015-11-19 13:52, kimaidou wrote:</p>
<blockquote type="cite" 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" target="_blank">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" target="_blank">Qgis-developer@lists.osgeo.org</a><br> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">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><br></div>