pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Wilson <dan@acucore.com>
To: pgsql-php@postgresql.org
Subject: Re: PostgreSQL troubles with 4.0.3pl1
Date: Thu, 19 Oct 2000 21:40:48 -0700
Message-ID: <006d01c03a4f$ec040e10$078353d8@danwilson> (raw)
References: <012b01c039e7$4ba950f0$0200000a@doot>

Mitch,

I was having this problem as well.  I fixed it by making my connection
handle global within the function I was using to run all my queries.

Here's the basics of my function:

function runQuery($query, $db) {
    global $hCon; <--- I added this line
    $strConStr = "dbname=$db[database] user=$db[uname] password=$db[pword]
host=$db[host] port=$db[port]";
    $hCon = pg_connect($strConStr);
    return pg_exec($hCon, $query);
}

I know that shouldn't affect anything, but it fixed the problem.  I actually
did it on accident, but it worked.

Don't know if it will help you.

-Dan


----- Original Message -----
From: "Mitch Vincent" <mitch@venux.net>
To: <pgsql-php@postgresql.org>
Sent: Thursday, October 19, 2000 9:11 AM
Subject: PostgreSQL troubles with 4.0.3pl1


>     I've never had much trouble with PHP and PostgreSQL until this
morning..
> I was using persistent connections but started to have strange things
happen
> with PHP when I used them, so I elected to go back to using plain old
> pg_connect(). I did and everything seemed to be working fine, then this
> morning I go and log into my application and on most of my queries I get
> something like
>
> Warning: 1 is not a valid PostgreSQL link resource in
> /usr/site/php/classes/db_pgsql.inc on line 64
>
> Warning: 1 is not a valid PostgreSQL link resource in
> /usr/site/php/classes/db_pgsql.inc on line 67
>
>
> So it seems that pg_connect isn't returning false and that's a good thing,
> still it seems the connection index is unusable..
>
> I've stopped and restarted Apache and PostgreSQL, I even went so far as to
> reboot and ruin my impressive uptime to make sure everything that needed
to
> be restarted got restarted... It's almost as if it's still trying to use
> persistent connections..
>
> Has anyone seen this before? The problems with persistent connections
wasn't
> noticeable until 4.0.3pl1 so it might be a problem there..
>
>
> -Mitch
>
> "I'd change the world if God would just give me the source code."




view thread (2+ messages)

Message-ID: <006d01c03a4f$ec040e10$078353d8@danwilson>
Permalink:  ../006d01c03a4f$ec040e10$078353d8@danwilson/
Also on:    postgresql.org/message-id/006d01c03a4f$ec040e10$078353d8@danwilson

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: dan@acucore.com
  Subject: Re: PostgreSQL troubles with 4.0.3pl1
  In-Reply-To: <006d01c03a4f$ec040e10$078353d8@danwilson>
  References: <012b01c039e7$4ba950f0$0200000a@doot> <006d01c03a4f$ec040e10$078353d8@danwilson>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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