Roundcube doesn't load on fresh install, database error in logs

The /mail portal (is that roundcube?) doesn’t work on a fresh install, returning an “oops” message.

Looking in the nginx error.log it looks like a database error trying to create a session:

2024/08/02 09:10:06 [error] 1117#1117: *603 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Undefined constant PDO::MYSQL_ATTR_FOUND_ROWS in /usr/local/lib/roundcubemail/program/lib/Roundcube/db/mysql.php:129
Stack trace:
#0 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube_db.php(168): rcube_db_mysql->dsn_options()
#1 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube_db.php(154): rcube_db->conn_create()
#2 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube_db.php(259): rcube_db->dsn_connect()
#3 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube_db.php(450): rcube_db->db_connect()
#4 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube_db.php(418): rcube_db->_query()
#5 /usr/local/lib/roundcubemail/program/lib/Roundcube/session/db.php(114): rcube_db->query()
#6 [internal function]: rcube_session_db->read()
#7 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube_session.php(141): session_start()
#8 /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube.php(495): rcube_session->start()
#9 /usr/local/lib/rou" while reading response header from upstream, client: 176.58.116.165, server: box.REDACTED.com, request: "GET /mail/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.0-fpm.sock:", host: "box.REDACTED.com"

Ah it looks like this stack overflow post is relevant:

I’ll dig into that.

Checked for php mysql using apt list --installed | grep php. It wasn’t there,

ran

apt install php8.0-mysql
phpenmod pdo_mysql

and restarted. Error logged in nginx error.log is now:

2024/08/02 10:16:30 [error] 1054#1054: *2 FastCGI sent in stderr: "PHP message: PHP Warning:  file_put_contents(/usr/local/lib/roundcubemail/logs/errors.log): Failed to open stream: Permission denied in /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube.php on line 1380PHP message: PHP Warning:  SQLSTATE[HY000] [2002] No such file or directory in /usr/local/lib/roundcubemail/program/lib/Roundcube/rcube.php on line 1503" while reading response header from upstream, client: REDACTED, server: box.REDACTED.com, request: "GET /mail/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.0-fpm.sock:", host: "box.REDACTED.com", referrer: "https://box.REDACTED.com/"

It doesn’t look like mysql is running, i’m guessing there should be an instance on the box?

Ah looks like roundcube is altered to use a sqlite database instead. Hmm now I’ve no idea where to turn next. Anybody had a similar problem with a fresh install?

Solved.

Similar to the issue I had here: Admin interface assets forbidden by nginx

This was a permissions issue during installation. For some reason the permissions on the roundcube config file that the setup process creates were incorrect. This meant that roundcube was defaulting to invalid configuration.

note the permissions on config.inc.php below:

root@box:~# tree -p /usr/local/lib/roundcubemail/ -L 2
[drwxrwxr-x]  /usr/local/lib/roundcubemail/
├── [drwxrwxr-x]  config
│   ├── [-rw-r-----]  config.inc.php
│   ├── [-rw-rw-r--]  config.inc.php.sample
│   ├── [-rw-rw-r--]  defaults.inc.php
│   └── [-rw-rw-r--]  mimetypes.php
├── [-rw-rw-r--]  index.php

The fix was:

chmod 755 /usr/local/lib/roundcubemail/config/config.inc.php
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.