Roundcube error

Hi,


Some basics:

Code:
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

Code:
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:

Code:
[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.

Code:
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
 
Did you set up
Code:
$rcmail_config['db_dsnw'] =
in roundcube/config/db.inc.php
If I remember update for roundcube was yesterday. From what version did you update?
 
Abriel said:
Did you setup
Code:
$rcmail_config['db_dsnw'] =
in roundcube/config/db.inc.php
If i remember update for roundcube was yesterday. From what version did you update?


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

I have been running updates about every two weeks.
 
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.

Code:
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.
 
Nor me I'm afraid. My DSN is similar to yours:

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

And I have similar ports installed:

Code:
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?
 
xtaz said:
Nor me I'm afraid. My DSN is similar to yours:

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

And I have similar ports installed:

Code:
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?


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

Sincerely,

Brendhan
 
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.

Code:
<?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
 
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.

Code:
<?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
 
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
 
Roundcube will also give you this error when it cannot get read access to the configuration file under the roundcube/config directory. Make sure your webserver or PHP process have read access.
 
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
 
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:

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

Your option #2

Code:
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
 
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
 
Back
Top