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 EB8AC53A7F for ; Thu, 31 Mar 2005 20:56:58 +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 54263-07 for ; Thu, 31 Mar 2005 19:56:56 +0000 (GMT) Received: from tomts16-srv.bellnexxia.net (tomts16-srv.bellnexxia.net [209.226.175.4]) by svr1.postgresql.org (Postfix) with ESMTP id BC8E65387B for ; Thu, 31 Mar 2005 20:56:55 +0100 (BST) Received: from acer.sympatico.ca ([65.95.135.211]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050331195654.ZLQP27508.tomts16-srv.bellnexxia.net@acer.sympatico.ca> for ; Thu, 31 Mar 2005 14:56:54 -0500 Message-Id: <5.2.1.1.0.20050331145111.05828bf0@pop6.sympatico.ca> X-Sender: b1wudu74@pop6.sympatico.ca X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Thu, 31 Mar 2005 14:56:52 -0500 To: pgsql-php@postgresql.org From: Frank Bax Subject: Re: failed connection to postgres In-Reply-To: <1112283535.424c198f6f8ec@sms.ed.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.104 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/69 X-Sequence-Number: 3084 At 10:38 AM 3/31/05, 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? READ THE ERROR MESSAGE!! It's telling you that 'dbuser' is not a valid connection option - you won't find 'dbuser' mentioned anywhere on the man page (perhaps you should read it more carefully too): http://www.php.net/manual/en/function.pg-connect.php