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

Re: Postgre/PHP installation woes




OK -- many thanks, much better -- the parse error is gone, so it appears that the PHP page is connecting to the database! Alllllll right! (Please forgive the missing ')' in the string below, I'm not a PHP programmer, but I'm learning in a hurry. And under the old config, these files worked perfectly as they were, so...go figure.)

However, the page is still refusing logins and passwords that were scripted into the DB (from the "fake_data" file), including the postgres db main user (not postgres, in our case).

So, my next stop is to figure out how to manually add users into our database, to make sure that we have a working user in there.

Thanks again -- any further suggestions welcome.


On Feb 25, 2004, at 12:21 PM, jdc@astrid.be wrote:

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: