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@telesuite.gr url: 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
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
--------------------