Re: Cannot connect to remote postgres using php
От | Dimitris Sakellarios |
---|---|
Тема | Re: Cannot connect to remote postgres using php |
Дата | |
Msg-id | C9E90317C38C42179737E941E16F7685@toshiba обсуждение исходный текст |
Ответ на | Cannot connect to remote postgres using php (Archana K N <archanakknn@gmail.com>) |
Ответы |
Re: Cannot connect to remote postgres using php
|
Список | pgsql-php |
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
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
--------------------
В списке pgsql-php по дате отправления: