# Roundcube error



## Understudy (May 29, 2013)

Hi,


Some basics:


```
FreeBSD postal.brendhanhorne.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: 
Tue Jun 12 01:47:53 UTC 2012     root@i386-builder.
daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```


```
postal# pkg_info | grep roundcube
roundcube-0.9.1,1   Fully skinnable XHTML/CSS webmail written in PHP
```

Roundcube is currently not working on my mailserver. When I checked the error log I saw this:


```
[29-May-2013 03:37:42 +0000]: DB Error: Configuration error. 
Unsupported database driver:  in 
/usr/local/www/roundcube/program/lib/Roundcube/rcube_db.php on line 75 
(GET /roundcube/)
```


Here is what is in rcube_db.php on line 75.


```
70.        $driver = isset($driver_map[$driver]) ? $driver_map[$driver] : $driver;
71.        $class  = "rcube_db_$driver";
72.
73.        if (!$driver || !class_exists($class)) {
74.            rcube::raise_error(array('code' => 600, 'type' => 'db',
75.                'line' => __LINE__, 'file' => __FILE__,
76.                'message' => "Configuration error. Unsupported database driver:
77.                true, true);
```


I am definitely not understanding this. 



Sincerely,

Brendhan


----------



## Abriel (May 29, 2013)

Did you set up 
	
	



```
$rcmail_config['db_dsnw'] =
```
 in roundcube/config/db.inc.php 
If *I* remember update for *roundcube* was yesterday. From what version did you update?


----------



## xtaz (May 29, 2013)

The latest Roundcube requires PDO support in PHP. You probably want to install databases/php5-pdo and databases/php5-pdo_mysql, or whichever port relates to the database you use.


----------



## Understudy (May 29, 2013)

Abriel said:
			
		

> Did you setup
> 
> 
> 
> ...





```
$rcmail_config['db_dsnw'] = 'mysql://roundcube:roundcube@localhost(/tmp/mysql.sock)/roundcube';
```

I have been running updates about every two weeks.


----------



## Understudy (May 29, 2013)

xtaz said:
			
		

> The latest roundcube requires PDO support in PHP. You probably want to install databases/php5-pdo and databases/php5-pdo_mysql, or whichever port relates to the database you use.




```
postal# pkg_info | grep php
php5-5.4.15         PHP Scripting Language
php5-bcmath-5.4.15  The bcmath shared extension for php
php5-ctype-5.4.15   The ctype shared extension for php
php5-dom-5.4.15     The dom shared extension for php
php5-gettext-5.4.15 The gettext shared extension for php
php5-hash-5.4.15    The hash shared extension for php
php5-iconv-5.4.15   The iconv shared extension for php
php5-imap-5.4.15    The imap shared extension for php
php5-json-5.4.15    The json shared extension for php
php5-mbstring-5.4.15 The mbstring shared extension for php
php5-mcrypt-5.4.15  The mcrypt shared extension for php
php5-mysql-5.4.15   The mysql shared extension for php
php5-mysqli-5.4.15  The mysqli shared extension for php
php5-pdo-5.4.15     The pdo shared extension for php
php5-pdo_mysql-5.4.15 The pdo_mysql shared extension for php
php5-pdo_sqlite-5.4.15 The pdo_sqlite shared extension for php
php5-posix-5.4.15   The posix shared extension for php
php5-session-5.4.15 The session shared extension for php
php5-simplexml-5.4.15 The simplexml shared extension for php
php5-sockets-5.4.15 The sockets shared extension for php
php5-sqlite3-5.4.15 The sqlite3 shared extension for php
php5-tokenizer-5.4.15 The tokenizer shared extension for php
php5-wddx-5.4.15    The wddx shared extension for php
php5-xml-5.4.15     The xml shared extension for php
php5-xmlreader-5.4.15 The xmlreader shared extension for php
php5-xmlrpc-5.4.15  The xmlrpc shared extension for php
php5-xmlwriter-5.4.15 The xmlwriter shared extension for php
php5-zip-5.4.15     The zip shared extension for php

postal# pkg_info | grep mysql
mysql-client-5.5.31 Multithreaded SQL database (client)
mysql-server-5.5.31 Multithreaded SQL database (server)
p5-DBD-mysql-4.021  MySQL driver for the Perl5 Database Interface (DBI)
php5-mysql-5.4.15   The mysql shared extension for php
php5-mysqli-5.4.15  The mysqli shared extension for php
php5-pdo_mysql-5.4.15 The pdo_mysql shared extension for php
```

It's in there.


----------



## Understudy (May 30, 2013)

Still have no clue as to how to fix this or what is wrong.


----------



## xtaz (May 31, 2013)

Nor me I'm afraid. My DSN is similar to yours:


```
$rcmail_config['db_dsnw'] = 'mysqli://roundcube:password@unix(/tmp/mysql.sock)/roundcube';
```

And I have similar ports installed:


```
php5-mysql-5.4.15   The mysql shared extension for php
php5-mysqli-5.4.15  The mysqli shared extension for php
php5-pdo-5.4.15     The pdo shared extension for php
php5-pdo_mysql-5.4.15 The pdo_mysql shared extension for php
```

The only thing I can possibly think of is when you get asked for options for compiling those ports it asks you if you want to use the native PHP driver or link to the MySQL client library. I selected use the native one.

And stupid question, but I assume apache, or php-fpm, or whatever it is you use has been restarted and definitely has those libraries loaded?


----------



## Understudy (Jun 1, 2013)

xtaz said:
			
		

> Nor me I'm afraid. My DSN is similar to yours:
> 
> 
> ```
> ...




I think I am going to reinstall roundcube. I have been doing `# apachectl graceful` after every alteration. 

Sincerely,

Brendhan


----------



## Understudy (Jun 1, 2013)

I did a complete reinstall of roundcube. That appears to have fixed the issue. 

Sincerely,

Brendhan


----------



## Martian (Jul 29, 2013)

Instead of a full re-install you could use the below as example for your new db.inc.php, just don't forget to replace the value of the $rcmail_config['db_dsnw'] variable to suit your DB configuration. It worked for me. alternatively just do diff on this below with the content in your db.inc.php to see what differs and merge.  main.inc.php can remain untouched.


```
<?php

/*
 +-----------------------------------------------------------------------+
 | Configuration file for database access                                |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 |                                                                       |
 +-----------------------------------------------------------------------+

*/

$rcmail_config = array();

// PEAR database DSN for read/write operations
// format is db_provider://user:password@host/database 
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// currently supported db_providers: mysql, mysqli, pgsql, sqlite, mssql or sqlsrv

$rcmail_config['db_dsnw'] = 'mysql://roundcube_user:roundcube_password@localhost/roundcume_database_here';
// postgres example: 'pgsql://roundcube:pass@localhost/roundcubemail';
// Warning: for SQLite use absolute path in DSN:
// sqlite example: 'sqlite:////full/path/to/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'] = '';

// use persistent db-connections
// beware this will not "always" work as expected
// see: http://www.php.net/manual/en/features.persistent-connections.php
$rcmail_config['db_persistent'] = FALSE;

// 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_contactgroups'] = 'contactgroups';
$rcmail_config['db_table_contactgroupmembers'] = 'contactgroupmembers';
$rcmail_config['db_table_session'] = 'session';
$rcmail_config['db_table_cache'] = 'cache';
$rcmail_config['db_table_cache_index'] = 'cache_index';
$rcmail_config['db_table_cache_thread'] = 'cache_thread';
$rcmail_config['db_table_cache_messages'] = 'cache_messages';
$rcmail_config['db_table_dictionary'] = 'dictionary';
$rcmail_config['db_table_searches'] = 'searches';
$rcmail_config['db_table_system'] = 'system';

// 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_contactgroups'] = 'contactgroups_ids';
$rcmail_config['db_sequence_searches'] = 'search_ids';


// end db config file
```


----------



## Understudy (Aug 4, 2013)

Just a follow up. I just did another `portupgrade` and had the same problem. My db.inc.php is not that different from yours so I do not believe this is the issue. 


```
<?php

/*
 +-----------------------------------------------------------------------+
 | Configuration file for database access                                |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 |                                                                       |
 +-----------------------------------------------------------------------+

*/

$rcmail_config = array();

// PEAR database DSN for read/write operations
// format is db_provider://user:password@host/database
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-ds
// currently supported db_providers: mysql, mysqli, pgsql, sqlite, mssql or sqls

$rcmail_config['db_dsnw'] = 'mysql://roundcube:example@unix(/tmp/mysql.sock)/r
// postgres example: 'pgsql://roundcube:pass@localhost/roundcubemail';
// Warning: for SQLite use absolute path in DSN:
// sqlite example: 'sqlite:////full/path/to/sqlite.db?mode=0646';

// PEAR database DSN for read only operations (if empty write database will be u
// useful for database replication
$rcmail_config['db_dsnr'] = '';

// use persistent db-connections
// beware this will not "always" work as expected
// see: http://www.php.net/manual/en/features.persistent-connections.php
$rcmail_config['db_persistent'] = FALSE;

// 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_contactgroups'] = 'contactgroups';
$rcmail_config['db_table_contactgroupmembers'] = 'contactgroupmembers';
$rcmail_config['db_table_session'] = 'session';
$rcmail_config['db_table_cache'] = 'cache';
$rcmail_config['db_table_cache_index'] = 'cache_index';
$rcmail_config['db_table_cache_thread'] = 'cache_thread';
$rcmail_config['db_table_cache_messages'] = 'cache_messages';
$rcmail_config['db_table_dictionary'] = 'dictionary';
$rcmail_config['db_table_searches'] = 'searches';
$rcmail_config['db_table_system'] = 'system';

// 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_contactgroups'] = 'contactgroups_ids';
$rcmail_config['db_sequence_searches'] = 'search_ids';


// end db config file
```

So it appears that the only way around this is a reinstall of roundcube. This is now the third time I have had to do this.

Sincerely,

Brendhan


----------



## Understudy (Aug 4, 2013)

Well it looks even worse. After this past rebuild I have the same issue. So the rebuild of roundcube does not solve it anymore. The roundcube support pages have been of no help at all. I will probably have to dump roundcube. I am going to submit a PR and let it go at that. 

Sincerely,

Brendhan


----------



## Understudy (Aug 4, 2013)

The PR report

http://www.freebsd.org/cgi/query-pr.cgi?pr=181014

Sincerely,

Brendhan


----------



## alexx (Sep 8, 2013)

*R*oundcube will also give you this error when it cannot get read access to the configuration file under the roundcube/config directory. *M*ake sure your webserver or *PHP* process have read access.


----------



## bisco (Sep 15, 2013)

I had the same issue after an update. I solved or nu it by chown-ing Roundcube's configuration files to www:www (I'm using NGINX as a webserver).

Hope it helps.

Alfredo


----------



## Understudy (Sep 26, 2013)

From a recent reply to my bug report. 

On 09/24/13 22:43, Mikk Mekk wrote:
> This was solved for me by either
>
> 1) creating a symlink to the roundcubemail conf files if they are outside the roundcube dir (e.g. to /etc/roundcube)
> 2) make sure the conf files and the dir can be read by the web server (e.g. chown to nginx or www)
Hi Mikk,

I assume you are talking about these files:

/usr/local/www/roundcube/config/db.inc.php
/usr/local/www/roundcube/config/db.inc.php.dist

Trying to put them with a symlink to /etc/roundcube will fail since:


```
postal# cd /etc/roundcube
/etc/roundcube: No such file or directory.
```

Your option #2


```
postal# ls -al
total 104
drwxr-xr-x   2 root  wheel    512 Aug 30 18:04 .
drwxr-xr-x  11 root  wheel    512 Aug 30 18:14 ..
-r--r--r--   1 root  wheel     31 Aug 21 13:26 .htaccess
-rw-------   1 root  wheel   2906 Jun  1 16:34 db.inc.php
-r--r--r--   1 root  wheel   2893 Aug 21 13:26 db.inc.php.dist
-rw-------   1 root  wheel  38411 Jun  1 16:38 main.inc.php
-r--r--r--   1 root  wheel  38672 Aug 30 18:04 main.inc.php.dist
-r--r--r--   1 root  wheel   2731 Aug 21 13:26 mimetypes.php
postal# chown www db.inc.php
postal# chown www main.inc.php
postal# ls -al
total 104
drwxr-xr-x   2 root  wheel    512 Aug 30 18:04 .
drwxr-xr-x  11 root  wheel    512 Aug 30 18:14 ..
-r--r--r--   1 root  wheel     31 Aug 21 13:26 .htaccess
-rw-------   1 www   wheel   2906 Jun  1 16:34 db.inc.php
-r--r--r--   1 root  wheel   2893 Aug 21 13:26 db.inc.php.dist
-rw-------   1 www   wheel  38411 Jun  1 16:38 main.inc.php
-r--r--r--   1 root  wheel  38672 Aug 30 18:04 main.inc.php.dist
-r--r--r--   1 root  wheel   2731 Aug 21 13:26 mimetypes.php
```
This option appears to have worked.

Now I guess someone who can write code better than I needs to submit a patch.

Sincerely,

Brendhan


----------



## SirDice (Sep 26, 2013)

No need to chown(8) the files. Just make sure the web server can read them. Looking at the permissions a simple `chmod og+r db.inc.php main.inc.php` should do the trick. The current permissions on the files only allows the owner to read (and write) them. `chmod og+r` adds read permissions to the group and 'other'. Just compare the permissions of those files with the rest of the files in that directory. I'm guessing a rather restrictive umask(1) may be the cause of the limited permissions. 

Handbook: 4.3. Permissions


----------

