Jump to content

How to connect to postgres before bug fix?


Davide

Recommended Posts

Hi all,

after some tries to connect with postgres I have yet problem.

The php code to connect:

 

<?php
pg_connect("host=localhost port=5432 dbname=[user]_[dbname] user=[user]_[dbuser] password=[passwd]");
?>

 

with [user], [dbname], [dbuser] and [passwd] right strings,

returns:

 

Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user "[user]" in /home/[user]/...

 

I've found that "host=localhost and port=5432" is right, but the error "Ident authentication failed" tell me there is only ident sameuser authentication method to connect postgres, so I should have a database naming "[user]" and not "[user]_[dbname]" created with cPanel (is not possible to create a database only "[user]" with cPanel).

 

I think maybe this problem is the same to connect with phpPgAdmin as detailed by djbob:

 

Here's the problem. You probably won't figure out what it means, but I'm keeping you posted anyways ;)

Still talking to cPanel on fixing this problem.

 

1) cPanel needs to be able to access PostgreSQL. The only way cPanel is able to authenticate is via the "ident sameuser" authentication method, or just using "trust" to allow anyone.

2) PHPPgAdmin needs to be able to access PostgreSQL. The only way PHPpgAdmin is able to authenticate is via the "password" or "md5" authentication methods, or just using "trust" to allow anyone.

3) "Trust" is not an OK configuration because it allows users to access other users' databases.

4) PostgreSQL does not allow multiple authentication methods.

 

I think "password" and "md5" authentication methods are better because more flexibles, but until cPanel don't fix the bug we can't do nothing.

 

Is there a way to connect? Is someone can connect with his postgre's database? How?

 

Thank you in advance

 

Davide

Link to comment
Share on other sites

Try connecting like this:

 

<?php
pg_connect("dbname=[user]_[dbname]");
?>

 

Let me know if it works.

 

It works correctly! :)

I understand. In cPanel it's no need to create user. Autentication is done with account user's file.

 

Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...