<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Richard,</div><div><br></div><div>Just checking for the most common errors, and taking a look at this fragment of the layer's debug dump:<br></div><div><br></div><div>[Thu May 26 23:45:30 2011].568123 msPostGISLayerOpen(): Query error.<br><span class="yshortcuts" id="lw_1306506285_3">Database connection</span> failed (could not connect to server: Permission denied<br>&nbsp; &nbsp; &nbsp; &nbsp; Is the server running on host "localhost" and accepting<br>&nbsp; &nbsp; &nbsp; &nbsp; TCP/IP connections on port 5432?<br>could not connect to server: Permission denied<br>&nbsp; &nbsp; &nbsp; &nbsp; Is the server running on host "localhost" and accepting<br>&nbsp; &nbsp; &nbsp; &nbsp; TCP/IP connections on port 5432?</div><div>&nbsp;<br>Using GeoServer, you have posted this connection string:<br><br>host=localhost dbname=osm password=sssst
 user=geo<br><br>Using Mapserver, you have posted this other connection string:<br><br>host=localhost dbname=osm password=******* user=geo<br><br>You receive a "<span class="yshortcuts" id="lw_1306506285_3">Database connection</span> failed (could not connect to server: Permission denied)", this means that there's a problem <br>with the connection parameters.<br><br>I can see a "sssst" password (5 chars) with Geoserver test and a "*******" password (7 chars) with Mapserver test, are you sure <br>that you're using the same password ???<br><br>Also, if you're using HBA, you have to do the Geoserver and the Mapserver test in the same machine because the ip address.<br><br>Cheers from México<br><br></div><div><font style="font-weight:bold;color:rgb(0, 96, 191);font-family:verdana, helvetica, sans-serif;" size="2">IC Carlos Ruiz</font><br><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new
 roman, new york, times, serif; font-size: 12pt;"><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Richard Duivenvoorde &lt;rdmailings@duif.net&gt;<br><b><span style="font-weight: bold;">To:</span></b> mapserver-users@lists.osgeo.org<br><b><span style="font-weight: bold;">Sent:</span></b> Friday, May 27, 2011 4:18 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [mapserver-users] mapserver6 (was 5)  postgis connection problem<br></font><br>
Sorry for wrong subject, I'm talking about mapserver6 here.<br><br>Ok, don't think it is a postgres/postgis problem...<br><br>Installed geoserver, and that is serving fine ....<br><br>Als0 tried mapserv from command line:<br>./mapserv -nh "QUERY_STRING=map=osmwm.map&amp;mode=map" &gt; /tmp/test11.png<br>also ok<br><br>mapfile snippet:<br><br>LAYER<br>&nbsp; &nbsp; NAME test<br>&nbsp; &nbsp; TYPE polygon<br>&nbsp; &nbsp; STATUS default<br>&nbsp; &nbsp; DEBUG 5<br>&nbsp; &nbsp; CONNECTIONTYPE postgis<br>&nbsp; &nbsp; CONNECTION "host=localhost dbname=osm password=sssst user=geo"<br>&nbsp; &nbsp; DATA "way28992 from (select * from landuse2) as foo using unique<br>osm_id using srid=28992"<br>&nbsp; &nbsp; FILTER "landuse in ('industrial', 'residential')"<br>&nbsp; &nbsp; METADATA<br>&nbsp; &nbsp; &nbsp; "WMS_TITLE"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "test"<br>&nbsp; &nbsp; &nbsp; "WMS_SRS"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "EPSG:28992"<br>&nbsp; &nbsp; &nbsp; "OWS_EXTENT"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "-26000 296000 293000 634000"<br>&nbsp; &nbsp; END<br>&nbsp; &nbsp; CLASS<br>&nbsp; &nbsp; STYLE<br>&nbsp; &nbsp; &nbsp; COLOR 255 0 0<br>&nbsp; &nbsp; END<br>&nbsp; &nbsp; STYLE<br>&nbsp; &nbsp; &nbsp; OUTLINECOLOR 0 0 0<br>&nbsp; &nbsp; &nbsp; WIDTH 3<br>&nbsp; &nbsp; &nbsp; ANTIALIAS TRUE<br>&nbsp; &nbsp; END<br>&nbsp; &nbsp; END #CLASS<br>&nbsp; END<br><br><br><br>On 05/26/2011 11:58 PM, Richard Duivenvoorde wrote:<br>&gt; Like somebody else in the list I have a strange problem with MS6 on a<br>&gt; fresh RHEL6 machine. Running the same data and mapfile in an older MS works.<br>&gt; Below as much info I could get.<br>&gt; Anybody a clue?<br>&gt; I can recompile or add debug statements if nessecary (will be on irc<br>&gt; tomorrow morning)<br>&gt; <br>&gt; Regards,<br>&gt; <br>&gt; Richard
 Duivenvoorde<br>&gt; <br>&gt; <br>&gt; I fail to get a postgres connection log somewhere on this machine...<br>&gt; <br>&gt; a new installed RHEL6 machine:<br>&gt; Red Hat Enterprise Linux Server release 6.0 (Santiago)<br>&gt; <br>&gt; running<br>&gt; "PostgreSQL 8.4.8 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)<br>&gt; 4.4.4 20100726 (Red Hat 4.4.4-13), 64-bit"<br>&gt; and<br>&gt; "1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1"<br>&gt; <br>&gt; mapserver -v gives<br>&gt; MapServer version 6.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML<br>&gt; SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV<br>&gt; SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER<br>&gt; SUPPORTS=WCS_SERVER INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE<br>&gt; <br>&gt; I've done a gdal and mapserver compile myself<br>&gt; <br>&gt; A database with OSM data and mapfile with connectionstring like:<br>&gt; CONNECTION "host=localhost dbname=osm
 password=xxxx user=geo"<br>&gt; keeps saying:<br>&gt; Permission denied Is the server running on host "localhost" and<br>&gt; accepting TCP/IP connections on port 5432? ) with connect string<br>&gt; 'host=localhost dbname=osm password=******* user=geo'<br>&gt; <br>&gt; while:<br>&gt; - I can connect with that user/password via psql<br>&gt; - can use shp2img and the same mapfile (generating a map)<br>&gt; - can do<br>&gt; ogrinfo -ro PG:'host=localhost user=geo password=xxxxxx dbname=osm' -sql<br>&gt; "select count(*) from mytable"<br>&gt; - even tried trust for all hosts in pg_hba.conf<br>&gt; <br>&gt; setting debug in LAYER at 5<br>&gt; <br>&gt; -- first part is from wms request (failing connection):<br>&gt; [Thu May 26 23:45:30 2011].566614 msPostGISLayerOpen called: way28992<br>&gt; from nl_osm_point using unique osm_id using srid=28992<br>&gt; [Thu May 26 23:45:30 2011].566704 msPostGISLayerOpen: No connection in<br>&gt; pool, creating a fresh
 one.<br>&gt; [Thu May 26 23:45:30 2011].568103 msPostGISLayerOpen: Connection failure.<br>&gt; [Thu May 26 23:45:30 2011].568123 msPostGISLayerOpen(): Query error.<br>&gt; Database connection failed (could not connect to server: Permission denied<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  Is the server running on host "localhost" and accepting<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  TCP/IP connections on port 5432?<br>&gt; could not connect to server: Permission denied<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  Is the server running on host "localhost" and accepting<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  TCP/IP connections on port 5432?<br>&gt; ) with connect string 'host=localhost dbname=osm password=******* user=geo'<br>&gt; Is the database running? Is it allowing connections? Does the specified<br>&gt; user exist? Is the password valid? Is the database on the standard port?<br>&gt; [Thu May 26 23:45:30 2011].568138 msDrawMap(): Image handling error.<br>&gt; Failed to
 draw layer named 'plaatsen'.<br>&gt; [Thu May 26 23:45:30 2011].568224 msPostGISLayerClose called: way28992<br>&gt; from nl_osm_point using unique osm_id using srid=28992<br>&gt; [Thu May 26 23:45:30 2011].568238 freeLayer(): freeing layer at 0x1c67250.<br>&gt; [Thu May 26 23:45:30 2011].568243 msPostGISLayerIsOpen called.<br>&gt; [Thu May 26 23:45:30 2011].568251 freeLayer(): freeing layer at 0x1c6a7f0.<br>&gt; [Thu May 26 23:45:30 2011].568255 msPostGISLayerIsOpen called.<br>&gt; <br>&gt; -- This part is from shp2img (connection succesfull):<br>&gt; [Thu May 26 23:47:55 2011].3388 msLayerIsVisible(): Skipping layer<br>&gt; (plaatsen) because no CLASS in the layer is in-scale for this MAP scale<br>&gt; [Thu May 26 23:47:55 2011].3450 msLayerIsVisible(): Skipping layer<br>&gt; (plaatsen) because no CLASS in the layer is in-scale for this MAP scale<br>&gt; [Thu May 26 23:47:55 2011].3457 msLayerIsVisible(): Skipping layer<br>&gt; (plaatsen) because no
 CLASS in the layer is in-scale for this MAP scale<br>&gt; [Thu May 26 23:47:55 2011].3470 msPostGISLayerOpen called: way28992 from<br>&gt; (select way28992, z_order, landuse, osm_id, name from nl_osm_polygon<br>&gt; order by z_order) as foo using unique osm_id using srid=28992<br>&gt; [Thu May 26 23:47:55 2011].3478 msPostGISLayerOpen: No connection in<br>&gt; pool, creating a fresh one.<br>&gt; [Thu May 26 23:47:55 2011].16884<br>&gt; msConnPoolRegister(residentialandindustry,host=localhost dbname=osm<br>&gt; password=xxxx user=geo,0x18ff430)<br>&gt; [Thu May 26 23:47:55 2011].27950 msPostGISLayerOpen: Got PostGIS version<br>&gt; 10500.<br>&gt; [Thu May 26 23:47:55 2011].27963 msPostGISLayerFreeItemInfo called.<br>&gt; [Thu May 26 23:47:55 2011].27971 msPostGISLayerInitItemInfo called.<br>&gt; [Thu May 26 23:47:55 2011].27986 msPostGISLayerWhichShapes called.<br>&gt; [Thu May 26 23:47:55 2011].27992 msPostGISParseData called.<br>&gt; [Thu May 26
 23:47:55 2011].28008 msPostGISParseData:<br>&gt; unique_column=osm_id, srid=28992, geom_column_name=way28992,<br>&gt; table_name=(select way28992, z_order, landuse, osm_id, name from<br>&gt; nl_osm_polygon order by z_order) as foo<br>&gt; [Thu May 26 23:47:55 2011].28012 msPostGISBuildSQL called.<br>&gt; [Thu May 26 23:47:55 2011].28016 msPostGISBuildSQLItems called.<br>&gt; [Thu May 26 23:47:55 2011].28021 msPostGISBuildSQLItems: 2 items requested.<br>&gt; [Thu May 26 23:47:55 2011].28025 msPostGISBuildSQLFrom called.<br>&gt; [Thu May 26 23:47:55 2011].28031 msPostGISBuildSQLWhere called.<br>&gt; [Thu May 26 23:47:55 2011].28034 msPostGISBuildSQLSRID called.<br>&gt; [Thu May 26 23:47:55 2011].28038 msPostGISBuildSQLSRID: SRID provided<br>&gt; (28992)<br>&gt; [Thu May 26 23:47:55 2011].28041 msPostGISBuildSQLBox called.<br>&gt; ...<br>&gt; _______________________________________________<br>&gt; mapserver-users mailing list<br>&gt; <a
 ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>&gt; http://lists.osgeo.org/mailman/listinfo/mapserver-users<br><br>_______________________________________________<br>mapserver-users mailing list<br><a ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br><br><br></div></div></div></body></html>