Postgress 和 PHP “用户身份验证失败" [英] Postgress and PHP "Ident authentication failed for user"

查看:43
本文介绍了Postgress 和 PHP “用户身份验证失败"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的本地服务器 (Ubuntu 14.04) 上一切正常.但是在测试服务器(Centos)上,我无法从 PHP(Yii 1.1)连接到我的数据库.在两台服务器上,我使用相同的转储、用户名、密码、postgres 和 php 代码版本.

On my local server (Ubuntu 14.04) all work ok. But on test server (Centos) i cannot connect from PHP (Yii 1.1) to my database. On both servers i used same dump, user name, password, postgres and php code versions.

在本地服务器 apache 上.测试 nginx.

On local server apache. On Test nginx.

CDbConnection 无法打开数据库连接:SQLSTATE[08006] [7]致命:用户tripinsu"的身份验证失败

CDbConnection failed to open the DB connection: SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "tripinsu"

pg_hba.conf:

pg_hba.conf:

local   all             all                                     md5
host    all             all             127.0.0.1/32            ident
host    all             all             ::1/128                 ident

推荐答案

我已修复.不确定我改变了什么.我只是从 ubuntu 复制我正确的配置.

I fixed. Not sure what i changed. I just copy my correct config from ubuntu.

local   all             postgres                                peer
local   all             all                                     md5
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5

我希望这对其他人有帮助

I hope this help somebody else

这篇关于Postgress 和 PHP “用户身份验证失败"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆