pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedfailed connection to postgres
3+ messages / 3 participants
[nested] [flat]
* failed connection to postgres
@ 2005-03-31 15:38 SG Edwards <s0460205@sms.ed.ac.uk>
2005-03-31 15:42 ` Re: failed connection to postgres Heather Johnson <hjohnson@nypost.com>
2005-03-31 19:56 ` Re: failed connection to postgres Frank Bax <fbax@sympatico.ca>
0 siblings, 2 replies; 3+ messages in thread
From: SG Edwards @ 2005-03-31 15:38 UTC (permalink / raw)
To: pgsql-php
If I use the following code to connect to postgres using PHP:
<?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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: failed connection to postgres
2005-03-31 15:38 failed connection to postgres SG Edwards <s0460205@sms.ed.ac.uk>
@ 2005-03-31 15:42 ` Heather Johnson <hjohnson@nypost.com>
1 sibling, 0 replies; 3+ messages in thread
From: Heather Johnson @ 2005-03-31 15:42 UTC (permalink / raw)
To: SG Edwards <s0460205@sms.ed.ac.uk>; +Cc: pgsql-php
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:
>
> <?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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: failed connection to postgres
2005-03-31 15:38 failed connection to postgres SG Edwards <s0460205@sms.ed.ac.uk>
@ 2005-03-31 19:56 ` Frank Bax <fbax@sympatico.ca>
1 sibling, 0 replies; 3+ messages in thread
From: Frank Bax @ 2005-03-31 19:56 UTC (permalink / raw)
To: pgsql-php
At 10:38 AM 3/31/05, SG Edwards wrote:
>If I use the following code to connect to postgres using PHP:
>
><?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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-03-31 19:56 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-31 15:38 failed connection to postgres SG Edwards <s0460205@sms.ed.ac.uk>
2005-03-31 15:42 ` Heather Johnson <hjohnson@nypost.com>
2005-03-31 19:56 ` Frank Bax <fbax@sympatico.ca>
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