pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
cant conect to dynamic host-URL
7+ messages / 4 participants
[nested] [flat]

* cant conect to dynamic host-URL
@ 2006-11-01 18:36 Dirk Becker <becker@adocom.de>
  2006-11-01 21:11 ` Re: cant conect to dynamic host-URL Brew <brew@theMode.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Dirk Becker @ 2006-11-01 18:36 UTC (permalink / raw)
  To: pgsql-php

Hi there, ive got a dynamic URL like myname.dyndns.org which links to my 
server
where my postgres database runs. The Problem is that the Connection 
fails with error:
"Warning: pg_connect(): Unable to connect to PostgreSQL server: unknown 
host name: adocom.dyndns.org"

Now, if i ping my dynamic address and use the resulting IP for the 
Connection all works fine.
I dont know where my i did something wrong, i use an Java-Applet which 
connects also with the dynamic Address and works fine too.   :(

Here is my php-Code i use:

// Option-class which holds some information
class Option {
    var $host    = "myname.dyndns.org";     // Adresse des DBMS-Servers
    var $port    = "5432";                              // Port auf dem 
das DBMS laeuft
    var $dbname  = "Database";                   // Name der Datenbank
    var $user    = "postgres";                        // DBMS Benutzer
    var $passwd  = "secret";                         // DBMS Passwort
}

// Connection in index.php
$conn = pg_connect("host=".$OptObj->host." port=".$OptObj->port." 
dbname=".$OptObj->dbname." user=".$OptObj->user." 
password=".$OptObj->passwd);



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: cant conect to dynamic host-URL
  2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
@ 2006-11-01 21:11 ` Brew <brew@theMode.com>
  2006-11-01 23:14   ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  0 siblings, 1 reply; 7+ messages in thread

From: Brew @ 2006-11-01 21:11 UTC (permalink / raw)
  To: Dirk Becker <becker@adocom.de>; +Cc: pgsql-php

Dirk......

Hi there, ive got a dynamic URL like myname.dyndns.org which links to my
> server
> where my postgres database runs. The Problem is that the Connection
> fails with error:
> "Warning: pg_connect(): Unable to connect to PostgreSQL server: unknown
> host name: adocom.dyndns.org"
>
> Now, if i ping my dynamic address and use the resulting IP for the
> Connection all works fine.


Are you running php on one machine and postgresql on a different machine?

If so, maybe the dynamic address redirection service doesn't handle port
5432.   Web servers typically use port 80.

I don't know where my i did something wrong, i use an Java-Applet which

> connects also with the dynamic Address and works fine too.   :(


Does it connect with postgresql, or something else on the machine using a
different port?

I think you can use telnet (or ssh?) to manually connect to any port number
of a host and see how (and if) the machine responds and get a better idea of
what's going on.

brew

-- 

Strange Brew (brew@theMode.com)

Check out my Stock Option website http://www.callpix.com
and my Musicians Free Classified http://www.TheMode.com

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: cant conect to dynamic host-URL
  2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  2006-11-01 21:11 ` Re: cant conect to dynamic host-URL Brew <brew@theMode.com>
@ 2006-11-01 23:14   ` Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  2006-11-02 08:23     ` Re: cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  0 siblings, 1 reply; 7+ messages in thread

From: Andy Shellam (Mailing Lists) @ 2006-11-01 23:14 UTC (permalink / raw)
  To: pgsql-php

[root@sydney ~]# nslookup adocom.dyndns.org
Server:         80.175.29.73
Address:        80.175.29.73#53

Non-authoritative answer:
Name:   adocom.dyndns.org
Address: 84.191.116.130

[root@sydney ~]# telnet adocom.dyndns.org 5432
Trying 84.191.116.130...
Connected to adocom.dyndns.org.
Escape character is '^]'.


Connects fine from my box.  How about firewalls?  We had a weird case at 
work a while back where a router somewhere along the line was blocking 
all connections until it was ping'd - then after it received a ping, 
it'd keep the connection open for 20 minutes or so, then start blocking 
again.  Turned out to be faulty!

One thing I would check is the domain name lookup.  Make sure your DNS 
servers are properly configured and respond timely (within 2 seconds.)  
Repeatedly do a "dig adocom.dyndns.org A" from your client for a minute 
and see if any time out and/or fail.

Andy.

Brew wrote:
> Dirk......
>
>     Hi there, ive got a dynamic URL like myname.dyndns.org
>     <http://myname.dyndns.org; which links to my
>     server
>     where my postgres database runs. The Problem is that the Connection
>     fails with error:
>     "Warning: pg_connect(): Unable to connect to PostgreSQL server:
>     unknown
>     host name: adocom.dyndns.org <http://adocom.dyndns.org>";
>
>     Now, if i ping my dynamic address and use the resulting IP for the
>     Connection all works fine.
>
>
> Are you running php on one machine and postgresql on a different machine?
>
> If so, maybe the dynamic address redirection service doesn't handle 
> port 5432.   Web servers typically use port 80.
>
> I don't know where my i did something wrong, i use an Java-Applet which
>
>     connects also with the dynamic Address and works fine too.   :(
>
>
> Does it connect with postgresql, or something else on the machine 
> using a different port?
>
> I think you can use telnet (or ssh?) to manually connect to any port 
> number of a host and see how (and if) the machine responds and get a 
> better idea of what's going on.
>
> brew
>
> -- 
>
> Strange Brew (brew@theMode.com <mailto:brew@theMode.com>)
>
> Check out my Stock Option website http://www.callpix.com
> and my Musicians Free Classified http://www.TheMode.com 
> !DSPAM:37,454926c440414055797109! 




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: cant conect to dynamic host-URL
  2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  2006-11-01 21:11 ` Re: cant conect to dynamic host-URL Brew <brew@theMode.com>
  2006-11-01 23:14   ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
@ 2006-11-02 08:23     ` Dirk Becker <becker@adocom.de>
  2006-11-02 09:47       ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  2006-12-05 23:15       ` Re: cant conect to dynamic host-URL Chris <dmagick@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Dirk Becker @ 2006-11-02 08:23 UTC (permalink / raw)
  To: pgsql-php

Andy Shellam (Mailing Lists) wrote:
> Connects fine from my box.  How about firewalls?  We had a weird case 
> at work a while back where a router somewhere along the line was 
> blocking all connections until it was ping'd - then after it received 
> a ping, it'd keep the connection open for 20 minutes or so, then start 
> blocking again.  Turned out to be faulty!
>
> One thing I would check is the domain name lookup.  Make sure your DNS 
> servers are properly configured and respond timely (within 2 
> seconds.)  from your client for a minute and see if any time out 
> and/or fail.
>
> Andy.

Thanks, but the error only apears while using php / pg_connect()
With pgsql i can connect through the dynamic url without problems :/
Could it be that pg_connect cant connect through real URLs ?

I run php 4.3.3 and PostgreSQL 8.1.0



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: cant conect to dynamic host-URL
  2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  2006-11-01 21:11 ` Re: cant conect to dynamic host-URL Brew <brew@theMode.com>
  2006-11-01 23:14   ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  2006-11-02 08:23     ` Re: cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
@ 2006-11-02 09:47       ` Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  2006-11-02 11:41         ` Re: cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  1 sibling, 1 reply; 7+ messages in thread

From: Andy Shellam (Mailing Lists) @ 2006-11-02 09:47 UTC (permalink / raw)
  To: Dirk Becker <becker@adocom.de>; +Cc: pgsql-php

 > Could it be that pg_connect cant connect through real URLs ?

The only difference with a dynamic URL is that the DNS expiry 
(time-to-cache) is much lower (usually 5 minutes as opposed to a day.)  
DNS clients don't see it any differently.
I would try a newer PHP version (latest in the 4 series is 4.4.4).

I must admit I've never had a problem with pg_connect not seeing a 
domain the server itself can.

Is the PostgreSQL server on the same box as PHP?  Have you tried 
connecting through domain sockets instead?

Andy.

Dirk Becker wrote:
> Andy Shellam (Mailing Lists) wrote:
>> Connects fine from my box.  How about firewalls?  We had a weird case 
>> at work a while back where a router somewhere along the line was 
>> blocking all connections until it was ping'd - then after it received 
>> a ping, it'd keep the connection open for 20 minutes or so, then 
>> start blocking again.  Turned out to be faulty!
>>
>> One thing I would check is the domain name lookup.  Make sure your 
>> DNS servers are properly configured and respond timely (within 2 
>> seconds.)  from your client for a minute and see if any time out 
>> and/or fail.
>>
>> Andy.
>
> Thanks, but the error only apears while using php / pg_connect()
> With pgsql i can connect through the dynamic url without problems :/
> Could it be that pg_connect cant connect through real URLs ?
>
> I run php 4.3.3 and PostgreSQL 8.1.0
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
> !DSPAM:37,4549ab3440414261817806!
>
>




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: cant conect to dynamic host-URL
  2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  2006-11-01 21:11 ` Re: cant conect to dynamic host-URL Brew <brew@theMode.com>
  2006-11-01 23:14   ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  2006-11-02 08:23     ` Re: cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  2006-11-02 09:47       ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
@ 2006-11-02 11:41         ` Dirk Becker <becker@adocom.de>
  0 siblings, 0 replies; 7+ messages in thread

From: Dirk Becker @ 2006-11-02 11:41 UTC (permalink / raw)
  To: pgsql-php

The Server i want to contact only runs the Database, no other services 
and on my Client i had compiled the same postgres version.
I also use an Java-Applet which runs in Browser and with that Applet i 
can connect via jdbc3 (8.1-407) with the dynamic-Address.
So I think it must be a problem with the php libs, i will upgrade soon 
my php-version to php5 for testing ...

Thanks for all your reply's until now :)


Andy Shellam (Mailing Lists) wrote:
> > Could it be that pg_connect cant connect through real URLs ?
>
> The only difference with a dynamic URL is that the DNS expiry 
> (time-to-cache) is much lower (usually 5 minutes as opposed to a 
> day.)  DNS clients don't see it any differently.
> I would try a newer PHP version (latest in the 4 series is 4.4.4).
>
> I must admit I've never had a problem with pg_connect not seeing a 
> domain the server itself can.
>
> Is the PostgreSQL server on the same box as PHP?  Have you tried 
> connecting through domain sockets instead?
>
> Andy.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: cant conect to dynamic host-URL
  2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
  2006-11-01 21:11 ` Re: cant conect to dynamic host-URL Brew <brew@theMode.com>
  2006-11-01 23:14   ` Re: cant conect to dynamic host-URL Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
  2006-11-02 08:23     ` Re: cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
@ 2006-12-05 23:15       ` Chris <dmagick@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Chris @ 2006-12-05 23:15 UTC (permalink / raw)
  To: Dirk Becker <becker@adocom.de>; +Cc: pgsql-php

Dirk Becker wrote:
> Andy Shellam (Mailing Lists) wrote:
>> Connects fine from my box.  How about firewalls?  We had a weird case 
>> at work a while back where a router somewhere along the line was 
>> blocking all connections until it was ping'd - then after it received 
>> a ping, it'd keep the connection open for 20 minutes or so, then start 
>> blocking again.  Turned out to be faulty!
>>
>> One thing I would check is the domain name lookup.  Make sure your DNS 
>> servers are properly configured and respond timely (within 2 
>> seconds.)  from your client for a minute and see if any time out 
>> and/or fail.
>>
>> Andy.
> 
> Thanks, but the error only apears while using php / pg_connect()
> With pgsql i can connect through the dynamic url without problems :/
> Could it be that pg_connect cant connect through real URLs ?

You mean urls coming through mod_rewrite or something?

If it works in general then it's not a php/pgsql issue but a code issue.

-- 
Postgresql & php tutorials
http://www.designmagick.com/



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2006-12-05 23:15 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-01 18:36 cant conect to dynamic host-URL Dirk Becker <becker@adocom.de>
2006-11-01 21:11 ` Brew <brew@theMode.com>
2006-11-01 23:14   ` Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
2006-11-02 08:23     ` Dirk Becker <becker@adocom.de>
2006-11-02 09:47       ` Andy Shellam (Mailing Lists) <andy.shellam-lists@mailnetwork.co.uk>
2006-11-02 11:41         ` Dirk Becker <becker@adocom.de>
2006-12-05 23:15       ` Chris <dmagick@gmail.com>

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