job.answiz.com
3 Answers
  • 4
Votes
name
name Punditsdkoslkdosdkoskdo

php postgress nightmares

A lecturer demanded that we do some homework in PHP and PostgreSQL, so I downloaded a package off the internet called "The BitNami WAPPStack" which had php, phpPgAdmin.

The problem is I have failed to access the database and I keep failing to login yet I have checked the password and its ok. am using the following:

  • username: Administrator
  • password: 123

Attempts at reading up the problem have failed. i came across some cryptic FAQs from phpPgAdmin

Login errors

Q: I always get "Login failed" even though I'm sure I'm using the right username and password.

A: There are a number of reasons why you might not be able to connect, typically having nothing to do with phpPgAdmin itself. First check the Postgres log on your server, it should contain a FATAL error message detailing the exact reason why the login is failing. You will probably need to either adjust the username or password, add LOGIN permissions to the role, or adjust your pg_hba.conf file in your Postgres data dir; so follow the directions laid out in the FATAL message.

  • you will probably need to adjust the username and password :( a've tried many times)
  • add LOGIN permissions to the role (what the heck is this geek stuff?)
  • adjust pg_hba.conf(why does a newbie have to edit any configurations?)

After several futile attempts am almost giving up.

Question

whats the most painless way of getting php, postgresql to work (set up file prefered to building from sources) Thanks.

EDIT: Am running windows xp sp2.

I am having trouble with my quotes in a function and think I have tried
every comb (obviously not) as it does not work:

I am trying to create a function within a function passing the second
function into the first as a parameter as follows:-

CREATE FUNCTION _test(text) RETURNS int AS '
BEGIN
EXECUTE ''
CREATE FUNCTION _test'' || $1 || '' () RETURNS int AS ''
BEGIN
RAISE EXCEPTION ''Help'';
RETURN 2;
END''; LANGUAGE ''plpgsql'' '';
RETURN 1;
END;'
LANGUAGE 'plpgsql';

SELECT _test('ing');

Could anyone tell me which bit is causing the problem as I am now completely
lost, the error message mentions is near LANGUAGE.

Many thanks

  • 1
Reply Report

There are two accounts to worry about here. You login to phpPgAdmin using the username "administator" and one password. The database itself is accessed using the username "postgres" and a second password. You should have been asked for the passwords at install time, and they can be the same. The usernames are different though, which seems like the most likely source for your problem.

Newbies have to edit the pg_hba.conf to make this easier because the installation is setup to be secure by default. You might want the simplest possible setup to install, but such a setup will leave you more vulnerable to being hacked too. BitNami has picked what they feel is a reasonable balance between security and ease of use with this two password system.

  • 1
Reply Report