3 Answers
  • 4
name Punditsdkoslkdosdkoskdo

Cannot Login to phpPgAdmin

I'm trying to set up phpPgAdmin on my test machine so that I can interface with PostgreSQL without always having to use the psql CLI. I have PostgreSQL 9.1 installed via the RPM repository, while I installed phpPgAdmin 5.0.4 "manually" (by extracting the archive from the phpPgAdmin website). For the record, my host OS is CentOS 6.2.

I made the following configuration changes already:


  • Inside pg_hba.conf, I changed all METHODs to md5.
  • I gave the postgres account a password
  • I added a new account named webuser with a password (note that I did not do anything else to the account, so I can't exactly say that I know what permissions it has and all)


  • Changed the line $conf['servers'][0]['host'] = ''; to $conf['servers'][0]['host'] = ''; (I've also tried using localhost as the value there).
  • Set $conf['extra_login_security'] to false.

Whenever I try to log in to phpPgAdmin, I get "Login failed", even if I use successful credentials (ones that work in psql). I've tried to go through some of the steps noted in Question 3 in the FAQ, but it hasn't worked out well so far there. It likely does not help that this is my first day working with PostgreSQL. I'm farily familiar with MySQL, but I have to use PostgreSQL for the project I'm working on.

Could anyone offer some help for how to set up phpPgAdmin on CentOS 6.2? If I've done something terribly wrong in my configuration so far, it's no big deal to blow something/everything away, as it's not like I've stored any data there yet!

I appreciate any insight you may have!

I tried the above solution but still got the 'Login Failed' message. To resolve, I had to ensure IPv6 is also set to password in the pg_hba.conf file. So do: vi /var/lib/pgsql/9.4/data/pg_hba.conf and edit accordingly. Then restart both httpd & postgresql (whatever the version you are using)

  • 1
Reply Report

On Sat, 28 Jul 2012 16:45:55 +0530
Archana K N <archanakknn(at)gmail(dot)com> wrote:

> Hello,
> I am having a problem with login in phppgadmin. I can connect to
> postgres using pgadmin 3 (from remote system also). But when am using
> phppgadmin it always shows "*Login Failed*". I tried several ways like
> changing php.ini file and pg_hba.conf nothing is working.
> Is this a problem with the phppgadmin?

I'm always having the same problem with phpPgAdmin anytime I install

Here's the solution I use on Debian:

First create the file /etc/apache2/conf.d/phppgadmin:

Alias /phppgadmin /usr/share/phppgadmin/

<Directory /usr/share/phppgadmin/>
DirectoryIndex index.php

Options +FollowSymLinks
AllowOverride None

order deny,allow
deny from all
allow from ::1/128
allow from all

<IfModule mod_php5.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_value include_path .

Next, get the latest snapshot:

$ git clone git://

Move the downloaded contens to /usr/share/phppgadmin

By default the “host” option is set for UNIX domain socket, you need to
change that for TCP/IP connections. In

$conf['servers'][0]['desc'] = 'PostgreSQL';

// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';

// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;

Restart Apache:

# /etc/init.d/apache2 restart

You can now access it using:

You can login using whatever account has been setup on PostgreSQL.
> regards

  • 1
Reply Report

Well, I figured it out - it was a combination of inexperience with PostgreSQL and very non-descriptive errors from phpPgAdmin.

Turns out I did not have TCP/IP access enabled, which meant that no PHP applications could access the database(s). To fix this, I had to make two changes:

  • It seemed to work better if I set listen_addresses to '*' in postgresql.conf. I'm not sure if that's entirely necessary or not, but on a well-firewalled machine like this one is, it shouldn't be a problem.
  • I had to run the command setsebool -P httpd_can_network_connect_db 1 from a terminal window to get Apache to actually get with the program and connect. I don't remember if I had to restart PostgreSQL after this step, but it probably wouldn't hurt.

One final note: I saw a few things suggesting changing a line tcpip_socket=true in postgresql.conf. This apparently does not work in PostgreSQL 9.1. In fact, it refused to start after I added that. So don't do it.

Anyways, hopefully this can help someone who runs into the same issues I did!

  • 1
Reply Report