Re: Postgre/PHP installation woes
On Tuesday 24 February 2004 18:50, Danny O'Brien shoved this is my mailbox:
> ... We have a PHP4 site that worked fine
> under a previous RedHat build, but we just can't get it working on this
> Debian build.
...
> But when we go to login to our PHP site, our login is rejected and we
> get the following error:
>
> Warning: Supplied argument is not a valid PostgreSQL link resource in
> <path>/auth.php on line 10
>
> Line 10 in auth.php looks like this:
>
> $result = pg_exec( $link, $sql );
>
> We've attempted to log in many times, so we know we're not mis-typing
> the password. Is the login prompt not hitting the database?
What happens is that a connection to the database is 'prepared' with a
'pg_connect' call:
http://be.php.net/pg_connect
(replace the be with your country code for a nearby mirror)
However, that connection seems to be broken and the first time it is used
(here in line 10) is bails out.
What you should do is have a look at the line where it connects to the
database. If this is a bigger webapp, chances are that the connection is made
in a separate file that is included, so you may not find it in your auth.php
file.
Try to do a grep for pg_connect through the php files of your site, or look at
the first 9 lines of auth.php, there's probably a file included (with
include("foo.bar"); ) That's where you should be looking.
Once you find the line, make sure that all values are correct (host, port, db
name, username, password). It may be that there's an error there, but I find
that unlikely : )
It's more likely that you've got a problem with the way client authentication
is configured. Are you familiar with the pg_hba file of postgres? If not:
http://www.postgresql.org/docs/7.4/static/client-authentication.html
You're probably trying to connect with a user that has no permissions to do
so.
Or, you postgresql isn't listening for TCP connections. That's a often made
mistake (it's in the postgresql FAQ):
http://www.postgresql.org/docs/faqs/FAQ.html
Check out question 3.5: How do I control connections from other hosts?
Can't find anything? Stop the postgresql deamon and start it from the command
line, keeping it in the foreground. You'll see exactly why it's not happy.
Whatever the problem, the password you type in doesn't matter, since you need
to have a working database connection before you can even start to verify if
the given password is correct.
Have fun : )
joost
(officially at -> joost at decock dot org)
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: