Dear Archana hi,
Follow below:
Step0
Make sure you have no firewall between you (php server root ip) and the server that blocks requests.
If this is OK then:
Step1
Inside postgresql.conf make sure you have set the listen IP and listen port of your server and this will be the port you connect with php pg_connect
Step2
Inside pg_hda.conf configure the hosts you will allow connection either as trusted or md5
Typically bellow will allow all to connect
hostnossl all all 0.0.0.0/0 trust
Below will allow all to connect using username and password (but before have the first rule enabled to create remotely the users)
hostnossl all all 0.0.0.0/0 md5
Step3 restart Pgsql server to grand the new setting.
BR,
From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org] On Behalf Of Archana K N
Sent: Monday, April 30, 2012 11:30 AM
To: pgsql-php@postgresql.org
Subject: [PHP] Cannot connect to remote postgres using php
Hello,
I am getting this error whenever I try to connect to remote computer.
"Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "10.162.19.3" and accepting TCP/IP connections on port 5432? "
--
-------------------
regards
archana
--------------------