Internal Server Error: Cannot login to Nextcloud

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 21.0.2.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): nginx/1.18.0
PHP version (eg, 7.4): 7.4.3

The issue you are facing:

Cannot login to Nextcloud, shows a plaintext page with Internal Server Error. OCC seems to work fine. I’ve also tried running db repair commands. This happened out of the blue so I’m not sure what change caused this.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Login to Nextcloud.

The output of your Nextcloud log in Admin > Logging:
Cannot open Admin terminal, but the occ log:tail and nextcloud.log consists of the following two lines repeated a couple thousand times.

{"reqId":"qJrRoPAxJ3tHobWP7e46","level":3,"time":"2021-06-21T09:33:00+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"implode(): Invalid arguments passed at /var/www/nextcloud/apps/logreader/lib/Log/Formatter.php#64","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":64,"function":"implode"},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":45,"function":"formatTraceLine","class":"OCA\\LogReader\\Log\\Formatter","type":"->"},{"function":"OCA\\LogReader\\Log\\{closure}","class":"OCA\\LogReader\\Log\\Formatter","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":46,"function":"array_map"},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":34,"function":"formatException","class":"OCA\\LogReader\\Log\\Formatter","type":"->"},{"file":"/var/www/nextcloud/apps/logreader/lib/Command/Watch.php","line":113,"function":"formatMessage","class":"OCA\\LogReader\\Log\\Formatter","type":"->"},{"file":"/var/www/nextcloud/apps/logreader/lib/Command/Watch.php","line":99,"function":"printItem","class":"OCA\\LogReader\\Command\\Watch","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OCA\\LogReader\\Command\\Watch","type":"->"},{"file":"/var/www/nextcloud/core/Command/Base.php","line":169,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"OC\\Core\\Command\\Base","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":215,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"--","version":"21.0.2.1"}
{"reqId":"qJrRoPAxJ3tHobWP7e46","level":3,"time":"2021-06-21T09:33:00+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"array_map(): Expected parameter 2 to be an array, null given at /var/www/nextcloud/apps/logreader/lib/Log/Formatter.php#73","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":73,"function":"array_map"},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":45,"function":"formatTraceLine","class":"OCA\\LogReader\\Log\\Formatter","type":"->"},{"function":"OCA\\LogReader\\Log\\{closure}","class":"OCA\\LogReader\\Log\\Formatter","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":46,"function":"array_map"},{"file":"/var/www/nextcloud/apps/logreader/lib/Log/Formatter.php","line":34,"function":"formatException","class":"OCA\\LogReader\\Log\\Formatter","type":"->"},{"file":"/var/www/nextcloud/apps/logreader/lib/Command/Watch.php","line":113,"function":"formatMessage","class":"OCA\\LogReader\\Log\\Formatter","type":"->"},{"file":"/var/www/nextcloud/apps/logreader/lib/Command/Watch.php","line":99,"function":"printItem","class":"OCA\\LogReader\\Command\\Watch","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OCA\\LogReader\\Command\\Watch","type":"->"},{"file":"/var/www/nextcloud/core/Command/Base.php","line":169,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"OC\\Core\\Command\\Base","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":215,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"--","version":"21.0.2.1"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '(redacted)',
  'passwordsalt' => '(redacted)',
  'secret' => '(redacted)',
  'trusted_domains' =>
  array (
    0 => '(redacted)',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.2.1',
  'overwrite.cli.url' => '(redacted)',
  'dbname' => '(redacted)',
  'dbhost' => '(redacted)',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '(redacted)',
  'dbpassword' => '(redacted)',
  'installed' => true,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'mail_from_address' => 'system',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '(redacted)',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '(redacted)',
  'mail_smtpport' => '(redacted)',
  'mail_smtpname' => '(redacted)',
  'mail_smtppassword' => '(redacted)',
  'filelocking-enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => '(redacted)',  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'app_install_overwrite' =>
  array (
    0 => 'circles',
    1 => 'checksum',
    2 => 'camerarawpreviews',
    3 => 'drawio',
  ),
  'encryption.legacy_format_support' => false,
  'encryption.key_storage_migrated' => false,
  'default_phone_region' => '(redacted)',
);

The output of your Apache/nginx/system log in /var/log/____:

No relevant logs

Hi.
Have you been able to connect at least once?
What has happened since then?

Not sure it is connected to that, but I see you use redis.
Have you checked the server user (www-data for you ?) is part of the redis group?
Do you have all the services runnning (redis-server, httpd, PHP,mysql)?

Hi,

Sorry for the late reply, I’m not sure why I didn’t get a notification.

I managed to actually recover my Nextcloud installation after completely reinstalling Nextcloud from scratch, and then copying over the old config and data. I’m still not sure as to what exactly caused the issue, but I suppose that confirms it probably wasn’t Redis, MariaDB or nginx.

I suspect it may have been due to PHP, but I can’t confirm because I did attempt a reinstall while reading solutions to a similar problem, and that seemed to only make the issue worse (though maybe it might’ve been a combination of both PHP and my Nextcloud instance being broken?)

Anyway, I’m just glad that I managed to get my installation back. Thanks for your help though!