[postgis-users] Mapserver and Postgis
Obe, Regina DND\MIS
robe.dnd at cityofboston.gov
Wed Mar 29 05:49:31 PST 2006
It would be the webserver (not the person browsing) so you really
shouldn't be having problems if the webserver and postgresql server are
on the same box. Even if you were only accepting local connections it
should work.
Given that you are getting an error "Permission denied for creating
socket"
and you don't seem to have a log in postgresql",
--Guess 1 --
My first guess is that you have some sort of lock-down mechanism
configured on your apache that is preventing the apache web user account
from creating a connection socket. I probably not the best person to
advise on that issue.
--Guess 2 --
It could also be the way you are trying to reference the host in
mapserver that it can't resolve it. If it's the same box you could just
use localhost for host (or even skip specifying the host I think
although I haven't attempted that so I could be wrong) and you don't
even need a password since you have it configured to trust local
connection.
Try
"user=dbuser dbname=gisdatabase host=localhost"
It could also be the mapserver cgi and postgis version you have are
incompatible.
Which version of mapserver cgi are you using?
Which version of postgresql and postgis are you using?
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net]
Sent: Wednesday, March 29, 2006 7:53 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Mapserver and Postgis
The webserver and postgis server is the same. They are on the network
192.
I just think, too , there is a firewall between the two networks.
I can connect to postggis via ssh but not via mapserver (script cgi). I
really don't know who is trying to connect to PostGIS when we run a URL
via browser to mapserver.
Obe, Regina DND\MIS escreveu:
> The lines below got a bit scramled so let me restate my understanding
> 1) You were able to connect to the database via your webserver with
> psql and it was successful e.g. you saw the psql prompt and can run a
> select statement.
> 2) Your local pc is on network 10. , your database server is on 192
> (I'm assuming if this is correct you've got some sort of routing going
> on between your 10 and 192 networks)
> 3) What network is your webserver on 10?
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net]
> Sent: Wednesday, March 29, 2006 7:24 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Mapserver and Postgis
>
>
>
>
> Obe, Regina DND\MIS escreveu:
>
>> Were you able to try psql from the webserver?
>>
>>
> here network 10 (with -h parameter) and in the webserver machine
>
>> What network is your webserver on?
>>
>>
> network 192
>
>> What network is your database server on?
>>
>>
>
>
>> What network is your local pc on?
>>
>>
> network 10
>
>> I just want to rule out the issue of your database server and
>> workstation is on a private network (192.168....) so they can see
>> each other, but your webserver is on a public network 200..... Etc.
>> Because that definitely will not work. A Private ip can never be
>> accessed except by a computer on that same private network. I know
>> its obvious but just wanted to state the obvious.
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net]
>> Sent: Wednesday, March 29, 2006 6:53 AM
>> To: PostGIS Users Discussion
>> Subject: Re: [postgis-users] Mapserver and Postgis
>>
>>
>>
>>
>> Obe, Regina DND\MIS escreveu:
>>
>>
>>> Is that machine your workstation or the webserver? If its not the
>>> webserver, then are you able to do the same test when logged in on
>>>
> the
>
>>>
>>>
>>
>>
>>> webserver?
>>>
>>>
>>>
>> This is my machine. I am using the -h option to connect to a
>> webserver.
>>
>>
>>> What does your pg_hba.conf on your postgresql server look like?
>>> This
>>>
>>>
>>
>>
>>> by default is in the data directory of your postgresql server. As
>>> Gregory mentioned this controls what computers are allowed to
>>> connect
>>>
>
>
>>> to the postgresql daemon.
>>>
>>>
>>>
>> My pg_hba.conf
>>
>> # TYPE DATABASE USER CIDR-ADDRESS METHOD
>>
>> # "local" is for Unix domain socket connections only
>> local all all trust
>> # IPv4 local connections:
>> host all all 10.0.0.0 255.0.0.0 password
>> host all all 172.0.0.0 255.0.0.0 password
>> host all all 192.168.0.0 255.0.0.0 password
>> host all all 127.0.0.1/32 trust
>> host all all 200.249.133.135 255.255.255.255
>> password
>> # IPv6 local connections:
>> host all all ::1/128 trust
>> host all all 192.168.0.0 255.255.0 0 password
>>
>> That's it.
>>
>>
>>> -----Original Message-----
>>> From: postgis-users-bounces at postgis.refractions.net
>>> [mailto:postgis-users-bounces at postgis.refractions.net]
>>> Sent: Tuesday, March 28, 2006 11:50 AM
>>> To: PostGIS Users Discussion
>>> Subject: Re: [postgis-users] Mapserver and Postgis
>>>
>>>
>>> Obe,
>>>
>>> Fortunately I have psql here in my machine and I tryed to connect
>>> using it.
>>>
>>> The connection was ok with your parameters psql -U postgres
>>> machine.domainmachine db
>>>
>>> Have you any suggestion ?
>>>
>>> Ezequias
>>>
>>> Obe, Regina DND\MIS escreveu:
>>>
>>>
>>>
>>>> Ezequias,
>>>>
>>>> Then I guess one thing to try would be connect into your webserver
>>>> via ssh or some other means and then do a ping on your postgresql
>>>>
>>>>
>> server.
>>
>>
>>>> That may not work depending on whether pinging is blocked or not.
>>>>
>>>> If you had a psql client on the webserver or can easily put one on,
>>>> then you can do more indepth analysis. With something like below
>>>>
>>>> psql -h myserver.mydomain.com mydb
>>>>
>>>> Also you said you logged in using ssh from your local computer to
>>>> the postgresql server. Did you try connecting to the postgresql
>>>> server via the psql client from your local pc. Just because you
can
>>>>
>
>
>>>> ssh
>>>>
>>>>
>> into
>>
>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>> the postgresql server doesn't necessarily mean postgres daemon is
>>>> listening on a TCP/IP port.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: postgis-users-bounces at postgis.refractions.net
>>>> [mailto:postgis-users-bounces at postgis.refractions.net]
>>>> Sent: Tuesday, March 28, 2006 8:37 AM
>>>> To: PostGIS Users Discussion
>>>> Subject: Re: [postgis-users] Mapserver and Postgis
>>>>
>>>>
>>>> Yes, I have a root account on webserver.
>>>>
>>>> Best regards...
>>>> Ezequias
>>>>
>>>> Obe, Regina DND\MIS escreveu:
>>>>
>>>>
>>>>
>>>>
>>>>> It could be that your webserver doesn't allow outbound connections
>>>>> on 5432 because it has a firewall in front blocking. As Greg
>>>>> mentioned it sounds like you aren't connecting at all.
>>>>>
>>>>> Do you have root access to your webserver?
>>>>>
>>>>> -----Original Message-----
>>>>> From: postgis-users-bounces at postgis.refractions.net
>>>>> [mailto:postgis-users-bounces at postgis.refractions.net]
>>>>> Sent: Tuesday, March 28, 2006 8:02 AM
>>>>> To: PostGIS Users Discussion
>>>>> Subject: Re: [postgis-users] Mapserver and Postgis
>>>>>
>>>>>
>>>>> Gregory,
>>>>> Many thanks but there is notthing on the postgresql-Tue.log :-( .
>>>>>
>>>>> I can start and stop the postgresql without problem. I use
>>>>> postmaster -D
>>>>>
>>>>> way.
>>>>>
>>>>> Another thing. How can I ping using mapserver ?
>>>>> Another thing2:I can log to postgis using ssh connection (as root
>>>>> and
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>>> after as postgres user). Another thing3:There is no password to
>>>>> postgis ( linux )user. The postgis (database) user has yes a
>>>>>
>>>>>
>> password
>>
>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>>> (and I used on the map
>>>>>
>>>>>
>>>>>
>>>>>
>>>> file)
>>>>
>>>>
>>>>
>>>>
>>>>> I hope you could understand my enviroment.
>>>>>
>>>>> Ezequias
>>>>>
>>>>> Gregory S. Williamson escreveu:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> 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
>>>>>> DBA
>>>>>> 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
>>>>>> Cc:
>>>>>> 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 port=5432'. 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.
>>>>>>
>>>>>> Sincerely...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
--
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
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
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally
privileged and/or exempt from disclosure pursuant to Massachusetts
law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and
delete the material from any computer.
More information about the postgis-users
mailing list