Module 'sqlite3' already loaded at Unknown#0 / Could not open mailbox

Help! I have two new fresh instances on a single shared hosting server where I am using separate subdomains (installations) and data directories. Everything appears well (All checks passed, basic funcionality) except for the Mail Application. Both installations are throwing the exact same TWO error messages, as shown below.

Installation Details
Nextcloud version: (19.0.0.12)
Cloud Linux (unable to determine, cPanel says “linux”)
Apache Version: 2.4.43
PHP Version: 7.2.30 (alt-php74)
MySQL Version: 5.7.30

Issues:

  1. Error “Module ‘sqlite3’ already loaded at Unknown#0” - Error seems to occur every 30 seconds and/or in conjunction with website actions. Only known problem by this error (at this time) is eating cycles and disk usage. The only cron jobs running on the server had been created by configuring backups for each nextcloud installation (utilizing Softaculous). The error continues, however, even after removing the backup configurations (which also deletes the cron jobs).

  2. Error “Unable to access mail”. I am trying to access services/mailboxes hosted on the same server from the same hosting provider. While I HAVE implemented “‘app.mail.verify-tls-peer’ => false,” in the config.php file located in each nextcloud config directory, horde logs do not indicate there is an issue with TLS (enabled or otherwise). Neither horde_imap.log or horde_smtp.log show errors and instead seem to show normal behavior (shown below).

This the first time I have seen these messages (new since fresh installs using 19.0.0). Mail has worked before but it was a previous installation of an older version while experimenting (learning/playing) and working out issues related to using PHP ea- vs alt- and which PHP version to use.

Steps to replicate “Could not open mailbox”:

  1. Install Mail application
  2. Configure Mail application (mail is hosted on the same server)
  3. Access Mail application

No combination of Mail configuration settings have been found to work!

Output from Nextcloud log in Admin > Logging:

Error PHP Module 'sqlite3' already loaded at Unknown#0
Error index Exception: The requested uri(/index.php/apps/mail/api/accounts/1/folders/SU5CT1g%3D/messages) cannot be processed by the script '/index.php/apps/mail/api/accounts/1/folders/SU5CT1g=/messages')
/home/[USER]/[SUBDOMAIN].[DOMAIN].com/lib/base.php - line 950:

OC\AppFramework\Http\Request->getRawPathInfo()

/home/[USER]/[SUBDOMAIN].[DOMAIN].com/index.php - line 37:

OC::handleRequest()

Line 950, base.php

  • $requestPath = $request->getRawPathInfo();*

Line 37, index.php

  • OC::handleRequest();*

Output of the two errors from nextcloud.log (debug mode enabled)
Error Module ‘sqlite3’ already loaded at Unknown#0

{"reqId":"xowmYFnU2gwxACjGoBfj","level":3,"time":"2020-06-21T02:29:43+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/index.php/apps/theming/img/core/filetypes/application-pdf.svg?v=2","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"78gwe1LTIhpcSDtYEWVr","level":3,"time":"2020-06-21T02:29:43+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/index.php/apps/theming/favicon/files?v=2","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"zcWwMg8eamUvFgJ0WGS4","level":3,"time":"2020-06-21T02:29:43+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/index.php/core/preview?fileId=138&x=32&y=32","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"FMX8d5Mfbbrluoyv8cfY","level":3,"time":"2020-06-21T02:29:47+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/index.php/settings/user","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"K37HUhVYcEL5xm2df673","level":3,"time":"2020-06-21T02:29:47+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"ZxNMkYOhW6JKZGjfK0fJ","level":3,"time":"2020-06-21T02:29:47+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/index.php/avatar/admin/145?v=0","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"xDmOK1pTE71bRNVaYoys","level":3,"time":"2020-06-21T02:29:49+00:00","remoteAddr":"[IP]","user":"[USER]","app":"PHP","method":"GET","url":"/index.php/settings/admin/serverinfo","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"HeCezqVWzYgL6GM9Ecrf","level":3,"time":"2020-06-21T02:29:50+00:00","remoteAddr":"[IP]","user":"--","app":"PHP","method":"GET","url":"/cron.php","message":"Module 'sqlite3' already loaded at Unknown#0","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}

Error Could not open mailbox

{"reqId":"9WIGSCPwkleYqKJnexwS","level":3,"time":"2020-06-21T02:36:41+00:00","remoteAddr":"[IP]","user":"[USER]","app":"index","method":"GET","url":"/index.php/apps/mail/api/accounts/1/folders/SU5CT1g%3D/messages?filter=is:important&limit=20","message":{"Exception":"Exception","Message":"The requested uri(/index.php/apps/mail/api/accounts/1/folders/SU5CT1g%3D/messages) cannot be processed by the script '/index.php/apps/mail/api/accounts/1/folders/SU5CT1g=/messages')","Code":0,"Trace":[{"file":"/home/[USERDIR]/[SUBDOMAIN].[DOMAIN].com/lib/base.php","line":950,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"/home/[USERDIR]/[SUBDOMAIN].[DOMAIN].com/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/home/[USERDIR]/[SUBDOMAIN].[DOMAIN].com/lib/private/AppFramework/Http/Request.php","Line":776,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}
{"reqId":"FkfeRQQaBphlGRcqjpMo","level":3,"time":"2020-06-21T02:36:41+00:00","remoteAddr":"[IP]","user":"[USER]","app":"index","method":"GET","url":"/index.php/apps/mail/api/accounts/1/folders/SU5CT1g%3D/messages?filter=is:starred+not:important&limit=20","message":{"Exception":"Exception","Message":"The requested uri(/index.php/apps/mail/api/accounts/1/folders/SU5CT1g%3D/messages) cannot be processed by the script '/index.php/apps/mail/api/accounts/1/folders/SU5CT1g=/messages')","Code":0,"Trace":[{"file":"/home/[USERDIR]/[SUBDOMAIN].[DOMAIN].com/lib/base.php","line":950,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"/home/[USERDIR]/[SUBDOMAIN].[DOMAIN].com/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/home/[USERDIR]/[SUBDOMAIN].[DOMAIN].com/lib/private/AppFramework/Http/Request.php","Line":776,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36","version":"19.0.0.12"}

Output from config.php file:

<?php
$CONFIG = array (
  'instanceid' => '[REMOVED]',
  'passwordsalt' => '[REMOVED]',
  'secret' => '[REMOVED]',
  'trusted_domains' => 
  array (
    0 => '[SUBDOMAIN].[DOMAIN].com',
  ),
  'datadirectory' => '/home/[USER]/[DATADIR4NCINSTANCES]/[DOMAIN]',
  'dbtype' => 'mysql',
  'version' => '19.0.0.12',
  'overwrite.cli.url' => 'https://[SUBDOMAIN].[DOMAIN].com',
  'dbname' => '[REMOVED]',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '[REMOVED]',
  'dbpassword' => '[REMOVED]',
  'installed' => true,
  'app_install_overwrite' => 
  array (
    0 => 'occweb',
  ),
  'mysql.utf8mb4' => true,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'app.mail.verify-tls-peer' => false,
  'mail_from_address' => '[USER]',
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '[DOMAIN].com',
  'mail_smtphost' => 'mail.[DOMAIN].com',
  'mail_smtpport' => '587',
);

Output from horde_imap.log:

------------------------------
>> Sun, 21 Jun 2020 02:36:40 +0000
>> Connection to: imap://mail.[DOMAIN].com/
>> Server connection took 0.0002 seconds.
S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE NAMESPACE LITERAL+ STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
C: 1 AUTHENTICATE PLAIN [INITIAL CLIENT RESPONSE (username: [EMAIL])]
S: 1 OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY STATUS=SIZE NAMESPACE LITERAL+ NOTIFY SPECIAL-USE COMPRESS=DEFLATE QUOTA] Logged in
>> Command 1 took 0.0275 seconds.
>> CACHE: Using the OCA\Mail\Cache\Cache storage driver.
C: 2 ENABLE QRESYNC
C: 3 LOGOUT
S: * ENABLED QRESYNC
S: 2 OK Enabled (0.001 + 0.000 secs).
>> Command 2 took 0.0006 seconds.
S: * BYE Logging out
S: 3 OK Logout completed (0.001 + 0.000 secs).
>> Command 3 took 0.0009 seconds.
------------------------------
>> Sun, 21 Jun 2020 02:36:40 +0000
>> Connection to: imap://mail.[DOMAIN].com/
>> Server connection took 0.0001 seconds.
S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE NAMESPACE LITERAL+ STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
C: 1 AUTHENTICATE PLAIN [INITIAL CLIENT RESPONSE (username: [EMAIL])]
S: 1 OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY STATUS=SIZE NAMESPACE LITERAL+ NOTIFY SPECIAL-USE COMPRESS=DEFLATE QUOTA] Logged in
>> Command 1 took 0.0199 seconds.
>> CACHE: Using the OCA\Mail\Cache\Cache storage driver.
C: 2 ENABLE QRESYNC
C: 3 LIST () "" (*) RETURN (SUBSCRIBED SPECIAL-USE)
S: * ENABLED QRESYNC
S: 2 OK Enabled (0.001 + 0.000 secs).
>> Command 2 took 0.0007 seconds.
S: * LIST () "." INBOX
S: * LIST (\Subscribed \UnMarked \Archive) "." INBOX.Archive
S: * LIST (\Subscribed \UnMarked \Junk) "." INBOX.spam
S: * LIST (\Subscribed \UnMarked \Trash) "." INBOX.Trash
S: * LIST (\Subscribed \UnMarked \Sent) "." INBOX.Sent
S: * LIST (\UnMarked) "." INBOX.Junk
S: * LIST (\Subscribed \UnMarked \Drafts) "." INBOX.Drafts
S: 3 OK List completed (0.001 + 0.000 secs).
>> Command 3 took 0.003 seconds.
C: 4 LIST () "" (INBOX INBOX.Archive INBOX.spam INBOX.Trash INBOX.Sent INBOX.Junk INBOX.Drafts) RETURN (STATUS (MESSAGES RECENT UIDNEXT UIDVALIDITY UNSEEN))
S: * LIST () "." INBOX
S: * STATUS INBOX (MESSAGES 2 RECENT 2 UIDNEXT 7 UIDVALIDITY 1591721576 UNSEEN 2)
S: * LIST (\UnMarked) "." INBOX.Archive
S: * STATUS INBOX.Archive (MESSAGES 0 RECENT 0 UIDNEXT 1 UIDVALIDITY 1591721582 UNSEEN 0)
S: * LIST (\UnMarked) "." INBOX.spam
S: * STATUS INBOX.spam (MESSAGES 0 RECENT 0 UIDNEXT 1 UIDVALIDITY 1591721581 UNSEEN 0)
S: * LIST (\UnMarked) "." INBOX.Trash
S: * STATUS INBOX.Trash (MESSAGES 0 RECENT 0 UIDNEXT 5 UIDVALIDITY 1591721580 UNSEEN 0)
S: * LIST (\UnMarked) "." INBOX.Sent
S: * STATUS INBOX.Sent (MESSAGES 0 RECENT 0 UIDNEXT 1 UIDVALIDITY 1591721579 UNSEEN 0)
S: * LIST (\UnMarked) "." INBOX.Junk
S: * STATUS INBOX.Junk (MESSAGES 0 RECENT 0 UIDNEXT 1 UIDVALIDITY 1591721578 UNSEEN 0)
S: * LIST (\UnMarked) "." INBOX.Drafts
S: * STATUS INBOX.Drafts (MESSAGES 0 RECENT 0 UIDNEXT 1 UIDVALIDITY 1591721577 UNSEEN 0)
S: 4 OK List completed (0.002 + 0.000 + 0.001 secs).
>> Command 4 took 0.006 seconds.
C: 5 LOGOUT
S: * BYE Logging out
S: 5 OK Logout completed (0.001 + 0.000 secs).
>> Command 5 took 0.0011 seconds.

Output from horde_smtp.log:

------------------------------
>> Sun, 21 Jun 2020 02:36:40 +0000
>> Connection to: smtp://mail.[DOMAIN].com:587
S: 220-webhosting2044.is.cc ESMTP Exim 4.93 #2 Sat, 20 Jun 2020 22:36:40 -0400 
S: 220-We do not authorize the use of this system to transport unsolicited, 
S: 220 and/or bulk e-mail.
C: EHLO [SUBDOMAIN].[DOMAIN].com
S: 250-[SERVER] Hello [SUBDOMAIN].[DOMAIN].com [IP]
S: 250-SIZE 104857600
S: 250-8BITMIME
S: 250-PIPELINING
S: 250-AUTH PLAIN LOGIN
S: 250-STARTTLS
S: 250 HELP
C: STARTTLS
S: 220 TLS go ahead
>> Successfully completed TLS negotiation.
C: EHLO [SUBDOMAIN].[DOMAIN].com
S: 250-[SERVER] Hello [SUBDOMAIN].[DOMAIN].com [IP]
S: 250-SIZE 104857600
S: 250-8BITMIME
S: 250-PIPELINING
S: 250-AUTH PLAIN LOGIN
S: 250 HELP
[AUTH Command - method: PLAIN; username: [EMAIL]]
S: 235 Authentication succeeded
C: QUIT
S: 221 [SERVER] closing connection

Mail access to same server hosted email is a necessary objective for the implementation of this nextcloud instance (is necessary).

Additional information can be provided upon request.

Thank you!

sqlite3 works like an standalone and embedded Data Base Management System, therefore it makes no sense enabling sqlite3 under the PHP Extension options in your cPanel since each developer who uses it in their apps, must include the binaries with the application or download it at runtime before working with it (in desktop apps), disabling that extension solved the problem for me.

As for Error “Unable to access mail”, I was unable to replicate the error since that app is working correctly in both ,19 and 20 versions. I would need to see the cPanel info under Email Accounts > Connect Devices under the email account that you are trying to access and show the manual config you are using while trying to connect, just server settings like hostname and ports.

I use shared linux servers and using cPanel, I disabled the php sqlite3 module, which stopped this error message appearing seemingly every 10 seconds or so.