title: PHP: How to know if a PostgreSQL persistent connection is already opened?
body: <p>According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the existing one if it already exists with same connection string.</p>
  
  <p>The problem I have is I want to know whether that call indeed creates a connection or actually returns the same, for example, for loading prepared statements in case it is the first connection.</p>
  
  <p>Can it actually be possible?</p>
  
  <p>UPDATE:
  With this question I am not referring to the current running PHP script. I want to know if the connection has been opened <em>sometime</em> (maybe by other scripts another time) or this script is the first in open that connection (for example, because I resetted the PostgreSQL server).</p>