Unable to resolve Internal server error

Nextcloud version (eg, 18.0.2): 19.0.0-1
Operating system and version (eg, Ubuntu 20.04): archlinuxarm
Apache or nginx version (eg, Apache 2.4.25): Apache2.4.43
PHP version (eg, 7.1):7.4.8

The issue you are facing:
I seem not to be able to get past the following “Internal Server Error”:

Internal Server Error

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.

Technical details

  • Remote Address: 192.168.1.###
  • Request ID: N56mdFEDTffHScB0dmqv
Version	mysqlnd 7.4.8
Compression	supported
core SSL	supported
extended SSL	supported
Command buffer size	4096
Read buffer size	32768
Read timeout	86400
Collecting statistics	Yes
Collecting memory statistics	No
Tracing	n/a
Loaded plugins	mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password

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

Steps to replicate it:

  1. Access the nextcloud directory on my webserver

The output of your Nextcloud log in Admin > Logging:

NA, unable to login to Nextcloud

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

<?php
$CONFIG = array (
  'instanceid' => 'ocy4w4gp6x34',
);

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

$ tail -f access_log 
192.168.1.222 - - [18/Jul/2020:22:27:29 -0700] "GET /index.php HTTP/1.1" 404 987
192.168.1.222 - - [18/Jul/2020:22:27:36 -0700] "GET /phpinfo.php HTTP/1.1" 200 70271
192.168.1.222 - - [18/Jul/2020:22:27:39 -0700] "GET /phpinfo.php HTTP/1.1" 200 70507
192.168.1.222 - - [18/Jul/2020:22:27:53 -0700] "GET /nextcloud/ HTTP/1.1" 200 156
192.168.1.222 - - [18/Jul/2020:22:27:53 -0700] "GET /nextcloud/index.php HTTP/1.1" 503 2643
141.98.10.171 - - [18/Jul/2020:22:30:05 -0700] "HEAD / HTTP/1.1" 200 -
192.168.1.222 - - [18/Jul/2020:22:35:03 -0700] "GET /nextcloud/index.php/csrftoken HTTP/1.1" 503 2643
192.168.1.222 - - [18/Jul/2020:22:50:03 -0700] "GET /nextcloud/index.php/csrftoken HTTP/1.1" 500 2301
192.168.1.222 - - [18/Jul/2020:22:50:39 -0700] "GET /nextcloud/ HTTP/1.1" 304 -
192.168.1.222 - - [18/Jul/2020:22:50:39 -0700] "GET /nextcloud/index.php HTTP/1.1" 500 2301

while:

$ ls -l /var/www/html/nextcloud/index.php  
-rw-r--r-- 1 http http 2960 Jun  5 06:17 /var/www/html/nextcloud/index.php

Without the nextcloud log file content it is nearly impossible to provide an answer. It isn’t necessary to view the log file content in the browser, you can usually access it on the console too. Please check e.g. the Nextcloud data directory where you should find the file. Additionally please use the search function of this forum to look for possible solutions of this problem. This kind of question is asked at least twice a week and in the most cases PHP update/installation/configuration problems are responsible for not being able to login again.

I understand what you are saying and I did do some research before posting here and I found that my PHP version should work fine with the nextcloud version and my phpinfo() seems to work fine too, hence I don’t expect php to be the culprit (but I may be wrong). Now for the missing logs, I know that it’ll be very tricky but there is no data directory, what I have is:

$ ls -l /var/www/html/nextcloud/
total 148
drwxr-xr-x 41 http http  4096 Jul 18 08:24 3rdparty
-rw-r--r--  1 http http 16522 Jun  5 06:17 AUTHORS
-rw-r--r--  1 http http 34520 Jun  5 06:17 COPYING
drwxr-xr-x 44 http http  4096 Jul 18 08:25 apps
drwxr-xr-x  2 http http  4096 Jul 18 22:49 config
-rw-r--r--  1 http http  3967 Jun  5 06:17 console.php
drwxr-xr-x 23 http http  4096 Jul 18 08:26 core
-rw-r--r--  1 http http  5140 Jun  5 06:17 cron.php
-rw-r--r--  1 http http   156 Jun  5 06:17 index.html
-rw-r--r--  1 http http  2960 Jun  5 06:17 index.php
drwxr-xr-x  6 http http  4096 Jul 18 08:26 lib
-rwxr-xr-x  1 http http   283 Jun  5 06:17 occ
drwxr-xr-x  2 http http  4096 Jul 18 08:26 ocm-provider
drwxr-xr-x  2 http http  4096 Jul 18 08:26 ocs
drwxr-xr-x  2 http http  4096 Jul 18 08:26 ocs-provider
-rw-r--r--  1 http http  3102 Jun  5 06:17 public.php
-rw-r--r--  1 http http  5332 Jun  5 06:17 remote.php
drwxr-xr-x  4 http http  4096 Jul 18 08:26 resources
-rw-r--r--  1 http http    26 Jun  5 06:17 robots.txt
-rw-r--r--  1 http http  2379 Jun  5 06:17 status.php
drwxr-xr-x  3 http http  4096 Jul 18 08:26 themes
drwxr-xr-x  2 http http  4096 Jul 18 08:26 updater
-rw-r--r--  1 http http   363 Jun  5 06:17 version.php

but I got the following in /var/log/httpd/error_log:

[Sun Jul 19 09:23:29.328439 2020] [php7:warn] [pid 589] [client 192.168.1.222:44836] PHP Warning:  fileperms(): stat failed for /var/www/html/nextcloud/data/nextcloud.log in /var/www/html/nextcloud/lib/private/Log/File.php on line 85
[Sun Jul 19 09:23:29.328694 2020] [php7:notice] [pid 589] [client 192.168.1.222:44836] {"reqId":"O38uZ9NnZG8rUxyvdfDe","level":3,"time":"2020-07-19T16:23:29+00:00","remoteAddr":"192.168.1.222","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php","message":"fileperms(): stat failed for /var/www/html/nextcloud/data/nextcloud.log at /var/www/html/nextcloud/lib/private/Log/File.php#85","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36","version":""}
[Sun Jul 19 09:23:29.328889 2020] [php7:notice] [pid 589] [client 192.168.1.222:44836] {"reqId":"O38uZ9NnZG8rUxyvdfDe","level":3,"time":"2020-07-19T16:23:29+00:00","remoteAddr":"192.168.1.222","user":"--","app":"index","method":"GET","url":"/nextcloud/index.php","message":{"Exception":"Doctrine\\\\DBAL\\\\DBALException","Message":"Failed to connect to the database: An exception occurred in driver: could not find driver","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":889,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":194,"function":"executeQuery","class":"Doctrine\\\\DBAL\\\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":200,"function":"executeQuery","class":"OC\\\\DB\\\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":216,"function":"execute","class":"Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppConfig.php","line":331,"function":"execute","class":"OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppConfig.php","line":109,"function":"loadConfigValues","class":"OC\\\\AppConfig","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppConfig.php","line":287,"function":"getApps","class":"OC\\\\AppConfig","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\\\AppConfig","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\\\App\\\\AppManager","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/legacy/OC_Template.php","line":286,"function":"isEnabledForUser","class":"OC\\\\App\\\\AppManager","type":"->"},{"file":"/var/www/html/nextcloud/lib/base.php","line":268,"function":"printErrorPage","class":"OC_Template","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":652,"function":"checkConfig","class":"OC","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1090,"function":"init","class":"OC","type":"::"},{"file":"/var/www/html/nextcloud/index.php","line":35,"args":["/var/www/html/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/lib/private/DB/Connection.php","Line":67,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36","version":""}
[Sun Jul 19 09:23:29.363334 2020] [php7:warn] [pid 589] [client 192.168.1.222:44836] PHP Warning:  fileperms(): stat failed for /var/www/html/nextcloud/data/nextcloud.log in /var/www/html/nextcloud/lib/private/Log/File.php on line 85
[Sun Jul 19 09:23:29.363559 2020] [php7:notice] [pid 589] [client 192.168.1.222:44836] {"reqId":"O38uZ9NnZG8rUxyvdfDe","level":3,"time":"2020-07-19T16:23:29+00:00","remoteAddr":"192.168.1.222","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php","message":"fileperms(): stat failed for /var/www/html/nextcloud/data/nextcloud.log at /var/www/html/nextcloud/lib/private/Log/File.php#85","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36","version":""}
[Sun Jul 19 09:23:29.363735 2020] [php7:notice] [pid 589] [client 192.168.1.222:44836] {"reqId":"O38uZ9NnZG8rUxyvdfDe","level":3,"time":"2020-07-19T16:23:29+00:00","remoteAddr":"192.168.1.222","user":"--","app":"PHP","method":"GET","url":"/nextcloud/index.php","message":"chmod(): No such file or directory at /var/www/html/nextcloud/lib/private/Log/File.php#86","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36","version":""}

and this in /var/log/httpd/access_log:

192.168.1.222 - - [19/Jul/2020:09:25:17 -0700] "GET /nextcloud/index.php HTTP/1.1" 500 2301
192.168.1.222 - - [19/Jul/2020:09:25:18 -0700] "GET /nextcloud/core/img/favicon.ico HTTP/1.1" 200 3262

So after seeing stat failed for /var/www/html/nextcloud/data/nextcloud.log, I created a data dir and touched a nextcloud.log file within which I got:

{
   "reqId":"oIu0pqhQvBDmG5MNy4Ai",
   "level":3,
   "time":"2020-07-19T16:27:42+00:00",
   "remoteAddr":"192.168.1.222",
   "user":"--",
   "app":"index",
   "method":"GET",
   "url":"/nextcloud/index.php",
   "message":{
      "Exception":"Doctrine\\DBAL\\DBALException",
      "Message":"Failed to connect to the database: An exception occurred in driver: could not find driver",
      "Code":0,
      "Trace":[
         {
            "file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",
            "line":889,
            "function":"connect",
            "class":"OC\\DB\\Connection",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/DB/Connection.php",
            "line":194,
            "function":"executeQuery",
            "class":"Doctrine\\DBAL\\Connection",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php",
            "line":200,
            "function":"executeQuery",
            "class":"OC\\DB\\Connection",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line":216,
            "function":"execute",
            "class":"Doctrine\\DBAL\\Query\\QueryBuilder",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/AppConfig.php",
            "line":331,
            "function":"execute",
            "class":"OC\\DB\\QueryBuilder\\QueryBuilder",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/AppConfig.php",
            "line":109,
            "function":"loadConfigValues",
            "class":"OC\\AppConfig",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/AppConfig.php",
            "line":287,
            "function":"getApps",
            "class":"OC\\AppConfig",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/App/AppManager.php",
            "line":136,
            "function":"getValues",
            "class":"OC\\AppConfig",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/App/AppManager.php",
            "line":225,
            "function":"getInstalledAppsValues",
            "class":"OC\\App\\AppManager",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/private/legacy/OC_Template.php",
            "line":286,
            "function":"isEnabledForUser",
            "class":"OC\\App\\AppManager",
            "type":"->"
         },
         {
            "file":"/var/www/html/nextcloud/lib/base.php",
            "line":268,
            "function":"printErrorPage",
            "class":"OC_Template",
            "type":"::"
         },
         {
            "file":"/var/www/html/nextcloud/lib/base.php",
            "line":652,
            "function":"checkConfig",
            "class":"OC",
            "type":"::"
         },
         {
            "file":"/var/www/html/nextcloud/lib/base.php",
            "line":1090,
            "function":"init",
            "class":"OC",
            "type":"::"
         },
         {
            "file":"/var/www/html/nextcloud/index.php",
            "line":35,
            "args":[
               "/var/www/html/nextcloud/lib/base.php"
            ],
            "function":"require_once"
         }
      ],
      "File":"/var/www/html/nextcloud/lib/private/DB/Connection.php",
      "Line":67,
      "CustomMessage":"--"
   },
   "userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36",
   "version":""
}{
   "reqId":"oIu0pqhQvBDmG5MNy4Ai",
   "level":3,
   "time":"2020-07-19T16:27:42+00:00",
   "remoteAddr":"192.168.1.222",
   "user":"--",
   "app":"PHP",
   "method":"GET",
   "url":"/nextcloud/index.php",
   "message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /var/www/html/nextcloud/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18",
   "userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36",
   "version":""
}

And I guess the key is Failed to connect to the database: An exception occurred in driver: could not find driver which is interesting as my phpinfo() tells me about Modules:

  • MySQL driver for PDO
  • MySQLi
  • MySQLnd

And mysqlnd has a larger section that reads:

mysqlnd enabled
Version mysqlnd 7.4.8
Compression supported
core SSL supported
extended SSL supported
Command buffer size 4096
Read buffer size 32768
Read timeout 86400
Collecting statistics Yes
Collecting memory statistics No
Tracing n/a
Loaded plugins mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password
API Extensions no value

Ok, you’re on the right track. Install the missing PHP modules, and make sure that they’re configured for both, the PHP web and the PHP cli component. Check-out the adminstrator guide to get an idea how a Nextcloud configuration file should look like:

https://docs.nextcloud.com/server/19/admin_manual/configuration_database/index.html?highlight=database#database-configuration

You find example configuration steps in that document too, which will most likely work on Archlinux too:

https://docs.nextcloud.com/server/19/admin_manual/installation/example_ubuntu.html

Using the search function of this forum showed me several Archlinux related postings which might help you to solve the problem:

https://help.nextcloud.com/search?q=archlinux

Okay, I got to move forward:

  • I installed nextcloud from the arch repo with pacman,
  • created a symlink in /var/www/html to /usr/share/webapps/nextcloud (I know this is not the best way of doing it as I’d rather use an Apache alias but I’ll get to that once I figure out my current issue with the MySQL login)
  • I installed the en_US.UTF-8 locale
  • added the php-gd package & enabled it in /etc/php/php.ini and now, I get to the screen to configure my admin account and set the MySQL credentials.
    I chose the db name localhost:3306 & set username & password up the same as in my little test script that looks like: (and can connect successfully)
<?php
$dbname = 'nextcloud';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'localhost';

$connect = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or die("Unable to Connect to '$dbhost'");
echo "Connection to $dbname established";

Nextcloud admin screen however gives me:

Error

MySQL username and/or password not valid You need to enter details of an existing account.

So, from the logfile I figured out:
"Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1044] Access denied for user 'oc_stdcerr12'@'localhost' to database 'nextcloud'"and then doing:
MariaDB [(none)]> grant all privileges on *.* to 'oc_stdcerr12'@'localhost' with grant option; to grant the user with the require priviledges, seems to have helped!

1 Like