[postgis-users] Mapserver and Postgis

Gregory S. Williamson gsw at globexplorer.com
Tue Mar 28 04:46:52 PST 2006

Ezequias --

What does the postgres log say ? That's a good place to start debugging this.

The text that you quoted has several very good suggestions; assuming that the connection string seems rational to you, i.e. user, password, server and database are all sane, I would suggest making sure that you can can ping the postgres server from the mapserver ... if so

Check the postgres log and see if it is refusing the connection. if it is you need to add the postgres user (not a great idea to exposte the DBA account as a working account, but that's another issue) and the IP address to the .hba file on the postres server. That file controls who can connect and can't; it is in the root of the directory the postgres database was created in.

If there is nothing in the log I'd suspect the TCP issue, or some routing issue since postgres will write a useful message if an un-authorized user tries to connect. Presumably the postgres user has permissions to connect to the database and access the tables.

It is possible the postgres instance was not started with the proper to allow TCP/IP connections; that is controlled by the script that starts the postgres database. I'm not sure if the error log would show anything in this case.

HTH, post back your results and maybe others can help more.

Greg Williamson
GlobeXplorer LLC
-----Original Message-----
From:	postgis-users-bounces at postgis.refractions.net on behalf of Ezequias Rodrigues da Rocha
Sent:	Tue 3/28/2006 4:35 AM
To:	PostGIS Users Discussion
Subject:	[postgis-users] Mapserver and Postgis

Hi list,

I don't know if this is a off-topic, but as nobody from mapserver could 
solve my problem I will report to you now.

I am trying to connect my mapserver project to PostGIS but my browser 
always report the folowing error:
msDrawMap(): Image handling error. Failed to draw layer named 'bairros'.
msPOSTGISLayerOpen(): Query error. couldnt make connection to DB with 
connect string 'user=postgres password=***** dbname=db host=xxx.xxx 
Error reported was 'could not create socket: Permission denied '.
This error occured when trying to make a connection to the specified 
postgresql server.
Most commonly this is caused by
(1) incorrect connection string
(2) you didnt specify a 'user=...' in your connection string
(3) the postmaster (postgresql server) isnt running
(4) you are not allowing TCP/IP connection to the postmaster
(5) your postmaster is not running on the correct port - if its not on 
5432 you must specify a 'port=...'
(6) the security on your system does not allow the webserver (usually 
user 'nobody') to make socket connections to the postmaster
(7) you forgot to specify a 'host=...' if the postmaster is on a 
different machine
(8) you made a typo

Could someone help me. As simple as possible would be very glad.


Ezequias Rodrigues da Rocha
msn:ezequias at hotmail.com
"the worst of democracies is still better than the best of dictatorship"

postgis-users mailing list
postgis-users at postgis.refractions.net


More information about the postgis-users mailing list