Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to install Roundcube on a CentOS 5.5 server, with a PostgreSQL 8.1.22 database.

The first page of the installer script, that checks for the presence of php libraries and such, gives me green OKs across the board. I even went out of my way to install the optional ones.

Page two generates me two configuration files (main.inc.php and db.inc.php) which I put into place.

Page three is where things go wrong:

Check DB config DSN (write): NOT OK(MDB2 Error: connect failed)

Make sure that the configured database exists and that the user has write privileges

DSN: pgsql://roundcube:password@localhost/roundcubemail

The info you see there (user roundcube, password password, server localhost and database roundcubemail) is all correct. The database roundcubemail belongs to the user roundcube and it has write permissions.

I have no clue why it can't connect to that database. I'm managing it with phpPgAdmin, which is running on the very same Apache, on the same server!

some more information: my postgres log file has a bunch of these:
FATAL: no pg_hba.conf entry for host "", user "roundcube", database "roundcubemail", SSL off
however, my pg_hba.conf file has this:
# "local" is for Unix domain socket connections only
local all all trust
host all all trust

Using telnet to connect to both localhost and on port 5432 works fine.

share|improve this question
You either are looking at a different pg_hba.conf file or you've forgot to reload Postgres after the changes. –  Milen A. Radev Dec 23 '10 at 13:21
Just did a pg_ctl reload and locate hba.conf gives me /usr/share/pgsql/pg_hba.conf.sample and /var/lib/pgsql/data/pg_hba.conf. Still no joy –  Kenny Rasschaert Dec 23 '10 at 13:47
Try psql -h -U roundcube roundcubemail at the console and report. –  Milen A. Radev Dec 23 '10 at 14:33
Welcome to psql 8.1.22, the PostgreSQL interactive terminal. roundcubemail=> –  Kenny Rasschaert Dec 23 '10 at 14:56
Temporarily remove the password from the Roundcube's DSN. Or put md5 in the pg_hba.conf for the local TCP/IP connections. –  Milen A. Radev Dec 23 '10 at 15:25
show 2 more comments

2 Answers

up vote 2 down vote accepted

The answer from DerfK above is wrong. You can use PostgreSQL using Unix socket with roundcube provided you're configuring it well. In the db.inc.php, it should read:

$rcmail_config['db_dsnw'] = 'pgsql://roundcube:*password*@unix(/tmp)/roundcube';

Provided you've created a "roundcube" user in pgsql for the database "roundcube" with password "password" In your main postgresql.conf, you should prevent listening on the IP layer, by changing:

listen_addresses = ''
unix_socket_directory = '/tmp'
ssl = false  # There's no point in using SSL on a local UNIX socket except wasting CPU

Also, and that is the most important part, you must change in pg_hba.conf to add this line:

local   all         roundcube                        md5

Restart everything, and it's working perfectly well and faster than using TCP connections (since you avoid all the IP encapsulation).

share|improve this answer
It's a pretty old question but I'll try to set up this stack again later today, just for the sake of accepting the correct answer. Thanks for answering! –  Kenny Rasschaert Jun 22 '12 at 10:57
add comment

Postgresql has two methods of connecting to it: network port and local file socket. phpPgAdmin is likely smart enough to use the socket when running on the same computer as the server, however according to a post here, roundcube cannot use the socket.

To grant access over the network, postgresql.conf needs to have an address to listen on in listen_address ('' is sufficient to only allow local connections, otherwise '*' to listen on all of your network addresses). If it is empty, then it will not listen to the network at all. Additionally, pg_hba.conf will need to allow connections from "host" in addition to the "local" connections.

share|improve this answer
I've changed postgresql.conf, pg_hba.conf and db.inc.php, restarted everything and so far, no luck. I'll keep trying stuff, thanks for helping. –  Kenny Rasschaert Dec 23 '10 at 0:32
@kenny.r: can you telnet localhost 5432 ? What do postgresql's logs say about roundcube's connection attempts? –  DerfK Dec 23 '10 at 3:35
I've updated my question with the information you requested. –  Kenny Rasschaert Dec 23 '10 at 13:14
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.