X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7BBA453AEE for ; Thu, 31 Mar 2005 16:46:25 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73875-02 for ; Thu, 31 Mar 2005 15:46:22 +0000 (GMT) Received: from nypost.com (ms1.nypost.com [206.15.109.53]) by svr1.postgresql.org (Postfix) with ESMTP id C4F8D53AB5 for ; Thu, 31 Mar 2005 16:46:20 +0100 (BST) Received: from ([10.238.16.157]) by ms1.nypost.com with ESMTP id 4220067.5505772; Thu, 31 Mar 2005 10:45:56 -0500 Message-ID: <424C1A83.5050401@nypost.com> Date: Thu, 31 Mar 2005 10:42:59 -0500 From: Heather Johnson User-Agent: Mozilla Thunderbird 0.8 (X11/20041018) X-Accept-Language: en-us, en MIME-Version: 1.0 To: SG Edwards Cc: pgsql-php@postgresql.org Subject: Re: failed connection to postgres References: <1112283535.424c198f6f8ec@sms.ed.ac.uk> In-Reply-To: <1112283535.424c198f6f8ec@sms.ed.ac.uk> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="ISO-8859-15"; format="flowed" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.237 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200503/68 X-Sequence-Number: 3083 I think you want "user" instead of "dbuser" in the pg_connect function: $conn =pg_connect("host=localhost dbname=milker user=s0460205 dbpass=password"); Heather Johnson SG Edwards wrote: > > If I use the following code to connect to postgres using PHP: > > echo "trying to connect to the database..."; > > $conn =pg_connect("host=localhost dbname=milker dbuser=s0460205 > dbpass=password"); > > if (!$conn) { > echo "no connection"; > } > ?> > > However, the connection is not made. If I try to run it from the command line in > UNIX I get the following error: > > PHP warning: pg_connect(): Unable to connect to PostgreSQL server: invalid > connection option "dbuser" in /home/s0460205/public_html/first.php on > line 12 > > The username, database name and password are definately right and my database is > on the same server as the script (thus I assume localhost for host?) so should > this not work? > > Many thanks for your help > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster ----------------------------------------- This message and its attachments may contain legally privileged and/or confidential information. If you are not the intended recipient (or responsible for delivery of the message to the intended recipient), you are hereby notified that you have received this transmission in error; any review, dissemination, distribution or copying of this transmission is strictly prohibited. If you have received this communication in error, please notify us immediately by reply or by telephone (call us at 212-930- 8000) and immediately delete this message and all its attachments. Any content of this message and its attachments that does not relate to the official business of NYP Holdings, Inc. must be taken not to have been sent or endorsed by any of them. No warranty is made that the e-mail or attachment(s) are f r e e from computer v i r u s or other defect.