pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_connect timeout ignored
2+ messages / 2 participants
[nested] [flat]

* pg_connect timeout ignored
@ 2004-02-23 21:36  Stephen <private@xxxxxxx.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Stephen @ 2004-02-23 21:36 UTC (permalink / raw)
  To: pgsql-php

I'm testing the connect_timeout option in pg_connect but the library seems
to ignore it. I set the pg_connect to connect to an invalid host IP and set
the connect_timeout=8 but the function returns in 30 seconds or more.

$DB = pg_connect(host=169.2.2.22 user=postgres database=xyz
connect_timeout=8);

I'm running Redhat 9 on Postgresql 7.4 and php-pgsql-4.2.2-17.2.

Any idea how the connect_timeout option works on PHP Pgsql?

Thanks,







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

* Re: pg_connect timeout ignored
@ 2004-02-26 00:48  ljb <ljb220@mindspring.com>
  parent: Stephen <private@xxxxxxx.com>
  0 siblings, 0 replies; 2+ messages in thread

From: ljb @ 2004-02-26 00:48 UTC (permalink / raw)
  To: pgsql-php

private@xxxxxxx.com wrote:
> I'm testing the connect_timeout option in pg_connect but the library seems
> to ignore it. I set the pg_connect to connect to an invalid host IP and set
> the connect_timeout=8 but the function returns in 30 seconds or more.
>
> $DB = pg_connect(host=169.2.2.22 user=postgres database=xyz
> connect_timeout=8);
>
> I'm running Redhat 9 on Postgresql 7.4 and php-pgsql-4.2.2-17.2.
>
> Any idea how the connect_timeout option works on PHP Pgsql?

It just passes the whole connection string through to the PostgreSQL
library libpq. So it isn't a problem with PHP. I tried it and it works for
me. I added "connect_timeout=2" to my connection string, and I got this
error (in 2 seconds) when trying to connect to an invalid IP address:

  Warning: pg_connect() [function.pg-connect.html]: Unable to connect to
  PostgreSQL server: timeout expired . in ...

I had to use 2 seconds. With 3 seconds or longer, I get a "no route to host,
is the server running..." error before it times out.

I'm running PostgreSQL-7.4.1 and  PHP-4.3.3 on Slackware 9.1 Linux. If the
problem you are having is fixed by an upgrade, I would try PostgreSQL-7.4.1
first (because I don't think PHP will affect it).



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


end of thread, other threads:[~2004-02-26 00:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-23 21:36 pg_connect timeout ignored Stephen <private@xxxxxxx.com>
2004-02-26 00:48 ` ljb <ljb220@mindspring.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