From: Dimitris Sakellarios <dimitris.sakellarios@telesuite.gr>
To: archanakknn@gmail.com
To: pgsql-php@postgresql.org
Subject: Re: Cannot connect to remote postgres using php
Date: Mon, 30 Apr 2012 19:40:36 +0300
Message-ID: <C9E90317C38C42179737E941E16F7685@toshiba> (raw)
First of all set all firewall down and then test again.
I remember you said that the PHP server and the PGSQL server are on
different machines? Is that correct?
If so how did you succeed to connect to local host? Did you move your PHP
code to the same machine hosting your PGSQL server or do you host a PGSQL
server on both machines?
Provide some more details (a small design) to give more help else it is
hopeless like that sorry. Also provide the the part of the PHP you try to
create the connection.
Try the below proposal.
On server that host the PHP (IP=y.y.y.y)
<?php
..
pg_connect("host=x.x.x.x port=5432 dbname=AAAAAAA user=BBBBBBBB
password=BBBBBBBB") or die('Could not connect: ' . pg_last_error());
..
?>
On server that host PGSQL (IP=x.x.x.x)
Inside pg_hba.conf
.
hostnossl all all 0.0.0.0/0 trust
..
Inside postgresql.conf
listen_addresses = 'x.x.x.x,localhost'
port = 5432
Test and report.
BR,
Sakellarios Dimitris
Telesuite ltd Telecommunication and Internet Services
Address : T. Sofouli 14, Post Code 16344, Ilioupoli - Athens, Greece
T.: +30 211 760 1300 F.: +30 211 176 9999 M.: +30 6982 550 850 e-mail:
dimitris.sakellarios <mailto:dimitris.sakellarios@telesuite.gr>
@telesuite.gr url: http://www.telesuite.gr <http://www.telesuite.gr/;
_____
From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org]
On Behalf Of Archana K N
Sent: Monday, April 30, 2012 6:58 PM
To: pgsql-php@postgresql.org
Subject: Re: [PHP] Cannot connect to remote postgres using php
My postgres server is listening to same port . I tried changing both but
same error is showing.
I restarted the servers after changing the conf files. pgadmin3 is running
on both servers and i can connect them remotely. I am able to connect to
local host using the php code.
I think i have changed the files correctly , some antivirus softwares are
running in the system i dont know whether that causes the problem.
--
-------------------
regards
archana
--------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: dimitris.sakellarios@telesuite.gr, archanakknn@gmail.com
Subject: Re: Cannot connect to remote postgres using php
In-Reply-To: <C9E90317C38C42179737E941E16F7685@toshiba>
References: <C9E90317C38C42179737E941E16F7685@toshiba>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox