Re: postgresql+php+double choco latte
| From: | Jouni Ahto | Date: | Wed, 01 Nov 2000 22:34:25 +0000 |
| Subject: | Re: postgresql+php+double choco latte | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4107@lists.php.net to get a copy of this message | ||
On Wed, 1 Nov 2000, Tom Mahoney wrote:
> PHP gives me the error below:
> ___________________________________________________________
> Fatal error: Call to undefined function: pg_connect() in pgsql.php3 on
> line 60
Means that PostgreSQL support is *not* compiled into PHP. You said that
you installed PostgreSQL from rpm. You have to install an rmp called
something like postgresql-dev.rpm too, otherwise it's not possible to
compile that support into PHP.
> A small chunk from that file is as follows:
> ___________________________________________________________
> function Connect($conn = "")
> {
> if ($conn == "")
> {
> if (!IsSet($GLOBALS["__DB_CONN__"]))
> {
> if
> (IsSet($GLOBALS["dbPassword"]) && $GLOBALS["dbPassword"] !=
> "")
> $this->conn =
> pg_connect(sprintf("dbname=%s port=%s host=%s user=%s password=%s",
> $GLOBALS["dbName"], $GLOBALS["dbPort"], $GLOBALS["dbHost"],
> $GLOBALS["dbUser"], $GLOBALS["dbPassword"]));
> else
> ( This is line 60 ) $this->conn =
> pg_connect($GLOBALS["dbHost"], $GLOBALS["dbPort"], "",
> $GLOBALS["dbName"]);
> $GLOBALS["__DB_CONN__"] =
> $this->conn;
> }
> else
> $this->conn =
> $GLOBALS["__DB_CONN__"];
> }
> else
> $this->conn = $conn;
>
> return $this->conn;
> _______________________________________________________________
> Now I looked on the php website and came across the information at this
> url:
> http://php.net/manual/html/function.pg-connect.html
> Which states that the syntax for pg_connect has been deprecated.
> So what I'm thinking is that the syntax above in both conditions ( there
> are two seperate database connect calls which are tried as near as I can
> tell ) is no longer supported yet the url I gave above doesn't make it
> very clear what the syntax has been replaced with.
The second version is deprecated, the first one the recommended. Both
work.
-- Jouni Ahto