I hate this situation - where you've read tens of threads describing the same problem as you, but all their solutions were either obvious or simply didn't work.
I'm getting the error "rcube_db.inc (105): DB Error: connect failed". At first I thought I found the problem for this as it seemed my Hosts scripts didn't set the permissions correctly when the database was set up.
So this is my db.inc.php file:
<?php
$rcmail_config = array();
// PEAR database DSN for read/write operations
// format is db_provider://user:password@host/databse
// currentyl suported db_providers: mysql, sqlite
$rcmail_config['db_dsnw'] = 'mysql://micromail:********@mysql1023.servage.net/micromail';
// postgres example: 'pgsql://roundcube:pass@localhost/roundcubemail';
// sqlite example: 'sqlite://./sqlite.db?mode=0646';
// PEAR database DSN for read only operations (if empty write database will be used)
// useful for database replication
$rcmail_config['db_dsnr'] = '';
// database backend to use (only db or mdb2 are supported)
$rcmail_config['db_backend'] = 'db';
// maximum length of a query in bytes
$rcmail_config['db_max_length'] = 512000; // 500K
// use persistent db-connections
$rcmail_config['db_persistent'] = TRUE;
// you can define specific table names used to store webmail data
$rcmail_config['db_table_users'] = 'users';
$rcmail_config['db_table_identities'] = 'identities';
$rcmail_config['db_table_contacts'] = 'contacts';
$rcmail_config['db_table_session'] = 'session';
$rcmail_config['db_table_cache'] = 'cache';
$rcmail_config['db_table_messages'] = 'messages';
// you can define specific sequence names used in PostgreSQL
$rcmail_config['db_sequence_users'] = 'user_ids';
$rcmail_config['db_sequence_identities'] = 'identity_ids';
$rcmail_config['db_sequence_contacts'] = 'contact_ids';
$rcmail_config['db_sequence_cache'] = 'cache_ids';
$rcmail_config['db_sequence_messages'] = 'message_ids';
// end db config file
?>
To test it wasn't an issue with the DB I created this file will successfully connects to the server and database:
$hostname = "mysql1032.servage.net";
$database = "micromail";
$username = "micromail";
$password = "*******";
$connection = mysql_pconnect($hostname, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
else {
echo 'Connected successfully
';
}
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
else {
echo 'Database selected successfully
';
}
?>
The database is MySQL5 and I imported mysql5.initial.sql which created 6 tables. I tried setting the host to "localhost" but this didn't work. I also tried turning off persistent connection.
A side note is that the logs aren't working. Just to be sure, I set the permission for logs/ to 777 but no files are being created. I had to set the debug_level to 4 to identify the error.