pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem with connection to remote server
6+ messages / 4 participants
[nested] [flat]
* problem with connection to remote server
@ 2010-01-28 09:51 Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 10:02 ` Re: problem with connection to remote server Andrew McMillan <andrew@morphoss.com>
0 siblings, 1 reply; 6+ messages in thread
From: Ireneusz Tarnowski @ 2010-01-28 09:51 UTC (permalink / raw)
To: pgsql-php
Hi,
I have some PHP application and 2 postgreSQL remote servers.
All servers are runing under Solaris 10.
I can connect from application to one postgresql server and all work fine. I have to move database to second server. I export/import data. Check all data inside database - OK. I can't connect from php application into second postgresql server.
I test if it possible to connect using psql -h remote_server and I can connect. I check firewall's ... but I can connect between application serwer and postgresql server using CMD (psql). Only PHP application can't connect. Otherside ... the PHP application works fine with first postgresql server (and PHP configuration supports psql).
I compared TCP packets and it looks like the application and server drop connection after first 2 packets (ACK).
Can anybody understand problem and know answer?
best regards
Irek
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with connection to remote server
2010-01-28 09:51 problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
@ 2010-01-28 10:02 ` Andrew McMillan <andrew@morphoss.com>
2010-01-28 12:43 ` Re: problem with connection to remote server Bill Moran <wmoran@potentialtech.com>
0 siblings, 1 reply; 6+ messages in thread
From: Andrew McMillan @ 2010-01-28 10:02 UTC (permalink / raw)
To: Ireneusz.Tarnowski@pwr.wroc.pl; +Cc: pgsql-php
On Thu, 2010-01-28 at 10:51 +0100, Ireneusz Tarnowski wrote:
> Hi,
>
> I have some PHP application and 2 postgreSQL remote servers.
> All servers are runing under Solaris 10.
>
> I can connect from application to one postgresql server and all work
> fine. I have to move database to second server. I export/import data.
> Check all data inside database - OK. I can't connect from php
> application into second postgresql server.
>
> I test if it possible to connect using psql -h remote_server and I
> can connect. I check firewall's ... but I can connect between
> application serwer and postgresql server using CMD (psql). Only PHP
> application can't connect. Otherside ... the PHP application works
> fine with first postgresql server (and PHP configuration supports
> psql).
>
> I compared TCP packets and it looks like the application and server
> drop connection after first 2 packets (ACK).
The place to look for error messages is in the PostgreSQL server log. I
would bet that it is rejecting the connection because the source ip/user
are different.
When you connect from the command-line it is probably using ident
information and that connection is being allowed, but the PHP
application will be running as the webserver user and will need
different credentials.
Check your pg_hba.conf file on the server and adjust it to let the
desired connection happen.
Cheers,
Andrew.
------------------------------------------------------------------------
http://andrew.mcmillan.net.nz/ Porirua, New Zealand
Twitter: _karora Phone: +64(272)DEBIAN
Be different: conform.
------------------------------------------------------------------------
Attachments:
signature.asc (application/pgp-signature, 197B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with connection to remote server
2010-01-28 09:51 problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 10:02 ` Re: problem with connection to remote server Andrew McMillan <andrew@morphoss.com>
@ 2010-01-28 12:43 ` Bill Moran <wmoran@potentialtech.com>
2010-01-28 13:36 ` Re: problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
0 siblings, 1 reply; 6+ messages in thread
From: Bill Moran @ 2010-01-28 12:43 UTC (permalink / raw)
To: Andrew McMillan <andrew@morphoss.com>; +Cc: Ireneusz.Tarnowski@pwr.wroc.pl; pgsql-php
In response to Andrew McMillan <andrew@morphoss.com>:
> On Thu, 2010-01-28 at 10:51 +0100, Ireneusz Tarnowski wrote:
> > Hi,
> >
> > I have some PHP application and 2 postgreSQL remote servers.
> > All servers are runing under Solaris 10.
> >
> > I can connect from application to one postgresql server and all work
> > fine. I have to move database to second server. I export/import data.
> > Check all data inside database - OK. I can't connect from php
> > application into second postgresql server.
> >
> > I test if it possible to connect using psql -h remote_server and I
> > can connect. I check firewall's ... but I can connect between
> > application serwer and postgresql server using CMD (psql). Only PHP
> > application can't connect. Otherside ... the PHP application works
> > fine with first postgresql server (and PHP configuration supports
> > psql).
> >
> > I compared TCP packets and it looks like the application and server
> > drop connection after first 2 packets (ACK).
>
> The place to look for error messages is in the PostgreSQL server log. I
> would bet that it is rejecting the connection because the source ip/user
> are different.
>
> When you connect from the command-line it is probably using ident
> information and that connection is being allowed, but the PHP
> application will be running as the webserver user and will need
> different credentials.
>
> Check your pg_hba.conf file on the server and adjust it to let the
> desired connection happen.
In addition to this, PHP will give some pretty useful error messages when
it can't connect. If you're not seeing those, then you should adjust
your application logic to log them, it will make your life a lot easier.
If they don't clearly define the problem, post them here ... I (and
others like me) have seen them enough to know what they indicate.
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with connection to remote server
2010-01-28 09:51 problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 10:02 ` Re: problem with connection to remote server Andrew McMillan <andrew@morphoss.com>
2010-01-28 12:43 ` Re: problem with connection to remote server Bill Moran <wmoran@potentialtech.com>
@ 2010-01-28 13:36 ` Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 13:46 ` Re: problem with connection to remote server Bill Moran <wmoran@potentialtech.com>
2010-01-29 10:52 ` Re: problem with connection to remote server Jasen Betts <jasen@xnet.co.nz>
0 siblings, 2 replies; 6+ messages in thread
From: Ireneusz Tarnowski @ 2010-01-28 13:36 UTC (permalink / raw)
To: Bill Moran <wmoran@potentialtech.com>; Andrew McMillan <andrew@morphoss.com>; +Cc: pgsql-php
> In addition to this, PHP will give some pretty useful error messages when
> it can't connect. If you're not seeing those, then you should adjust
> your application logic to log them, it will make your life a lot easier.
> If they don't clearly define the problem, post them here ... I (and
> others like me) have seen them enough to know what they indicate.
I have warning:
Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: No such file or directory Is the server running on host "XX.XX.XX.XX" and accepting TCP/IP connections on port 5432? in /export/sun1000/XXXXXXX/public_html/dbtest.php on line 10
And nothing more. Postgresql log, apache error log and php error log write nothing about this connection.
--
Irek
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with connection to remote server
2010-01-28 09:51 problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 10:02 ` Re: problem with connection to remote server Andrew McMillan <andrew@morphoss.com>
2010-01-28 12:43 ` Re: problem with connection to remote server Bill Moran <wmoran@potentialtech.com>
2010-01-28 13:36 ` Re: problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
@ 2010-01-28 13:46 ` Bill Moran <wmoran@potentialtech.com>
1 sibling, 0 replies; 6+ messages in thread
From: Bill Moran @ 2010-01-28 13:46 UTC (permalink / raw)
To: Ireneusz.Tarnowski@pwr.wroc.pl; +Cc: Andrew McMillan <andrew@morphoss.com>; pgsql-php
In response to Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>:
> > In addition to this, PHP will give some pretty useful error messages when
> > it can't connect. If you're not seeing those, then you should adjust
> > your application logic to log them, it will make your life a lot easier.
> > If they don't clearly define the problem, post them here ... I (and
> > others like me) have seen them enough to know what they indicate.
>
> I have warning:
>
> Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: No such file or directory Is the server running on host "XX.XX.XX.XX" and accepting TCP/IP connections on port 5432? in /export/sun1000/XXXXXXX/public_html/dbtest.php on line 10
>
> And nothing more. Postgresql log, apache error log and php error log write nothing about this connection.
This is usually the result of a network problem. hba problems are usually
reported as such by PHP. I would first 2x check the obvious ... did you
mistype the IP or hostname in the connection string? Check firewall logs
to ensure it's not being blocked by something. Run tcpdump on the server
to see if it's getting the syn packets.
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with connection to remote server
2010-01-28 09:51 problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 10:02 ` Re: problem with connection to remote server Andrew McMillan <andrew@morphoss.com>
2010-01-28 12:43 ` Re: problem with connection to remote server Bill Moran <wmoran@potentialtech.com>
2010-01-28 13:36 ` Re: problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
@ 2010-01-29 10:52 ` Jasen Betts <jasen@xnet.co.nz>
1 sibling, 0 replies; 6+ messages in thread
From: Jasen Betts @ 2010-01-29 10:52 UTC (permalink / raw)
To: pgsql-php
On 2010-01-28, Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl> wrote:
>> In addition to this, PHP will give some pretty useful error messages when
>> it can't connect. If you're not seeing those, then you should adjust
>> your application logic to log them, it will make your life a lot easier.
>> If they don't clearly define the problem, post them here ... I (and
>> others like me) have seen them enough to know what they indicate.
>
> I have warning:
>
> Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: No such file or directory Is the server running on host "XX.XX.XX.XX" and accepting TCP/IP connections on port 5432? in /export/sun1000/XXXXXXX/public_html/dbtest.php on line 10
>
> And nothing more. Postgresql log, apache error log and php error log write nothing about this connection.
"No such file or directory" is ENOENT but I can't see how errno is
getting set to that on an IP socket connectiom.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2010-01-29 10:52 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-01-28 09:51 problem with connection to remote server Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 10:02 ` Andrew McMillan <andrew@morphoss.com>
2010-01-28 12:43 ` Bill Moran <wmoran@potentialtech.com>
2010-01-28 13:36 ` Ireneusz Tarnowski <Ireneusz.Tarnowski@pwr.wroc.pl>
2010-01-28 13:46 ` Bill Moran <wmoran@potentialtech.com>
2010-01-29 10:52 ` Jasen Betts <jasen@xnet.co.nz>
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