[postgis-users] Mapserver and Postgis
Gregory S. Williamson
gsw at globexplorer.com
Tue Mar 28 14:29:31 PST 2006
If psql can connect, then the problem may be in the TCP/IP connectivity -- postgres has to be started with the proper parameter to allow for such connections; I think psql does not require them so ... perhaps you could find the script used to start your postmaster and post that ...
A sample from a 7.4 database we use is:
postgres at vdb-01 init.d]$ more postgres.vector
#!/bin/sh
# start/stop postgresql database
case "$1" in
'start')
# check if postgres died previously
if [ -f /data/postgres/gex_vector/postmaster.pid ]; then
rm /data/postgres/gex_vector/postmaster.pid
fi
su - postgres -c '/apps/pgsql/bin/pg_ctl start -D /data/postgres/gex_vector -l /var/log/postgres/gex_vector -o -i'
;;
...
The "-o -i" part is relevant here -- it starts the postmaster and tells it to allow TCP/Ip connections.
Again, the log should be showing complaints about a failure ... maybe you could tail some of it as well and post that.
HTH,
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 8:50 AM
To: PostGIS Users Discussion
Cc:
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
!DSPAM:4429693c202251333710190!
More information about the postgis-users
mailing list