Php connect to postgresql -


$dbconn = pg_connect("host=localhost   dbname=mydbname   user=myuser    password=mypass") or die(pg_last_error()); 

returns unable connect postgresql server: fatal: no pg_hba.conf entry host "::1 ...",

what must do?

p.s. in file php.ini modul extension php_pgsql.dll enabled

this or this would've helped determine nature of problem.

it looks you're trying connect on ipv6 (hence ::1) , host's pg_hba.conf doesn't have rule allowing connect ipv6 loopback address (::1) user myuser database mypass.

i suspect server misconfigured; work around try specifying host 127.0.0.1 (the ipv4 loopback address) instead of localhost, or omit host= use unix domain sockets if php supports that.

your statement "when use mysql (on remote server), host value can use host=localhost right?" nonsensical both mysql , postgresql. if it's remote server definition not on localhost. @ wild guess think might trying server remote in sense it's not computer working on, it's local to program running because running program on remote server (by editing on remote server, uploading program text on ftp, or whatever).


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -