[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Postgre/PHP installation woes



Quoting Danny O'Brien <dannyo@steinrogan.com>:

...
> This led me to examine "dbconnect.php" -- the following line is present:
> 
>   $link = pg_connect ("", "", "", "", "ourdb" or
>                          die ( "Could not connect to database." );

Danny,

First of all, that code snippet can't be right, you're missing a ')'

check out the pg_connect manual page at:
http://php.net/pg_connect
You should pass it a valid connection string, but yours has a lot of empty values.

Change:
$link = pg_connect ("", "", "", "", "ourdb" or
                          die ( "Could not connect to database." );

into:
$conn_string = "dbname=ourdb user=postgres password=drowssap";
$link = pg_connect($conn_string) or
                          die ( "Could not connect to database." );

This assumes that:
The postgres server runs on the same machine as the websever (I understand it
is). Since we didn't specify a host and port number, it will connect to the
localhost over a unix domain socket.
Your username is postgres (if it isn't, change it)
You password is drowssap (change it to the real password)

That should get you going

> 
> All suggestions welcome. Solution guaranteed posted to the list.

Since the solution includes your password, a 'it works' will do :)

Joost


DISCLAIMER
This e-mail and any attached files are confidential and may be legally privileged. If you are not the addressee, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. If you have received this transmission in error please notify A.S.T.R.I.D.  nv/sa immediately and then delete this e-mail.



Reply to: