Internal Server Error after upgrading to Ubuntu 20.04

Nextcloud version (eg, 18.0.2): 18.something (it’s not loading the UI, so I’m not sure where to check)
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): nginx 1.17.10
PHP version (eg, 7.1): 7.4-fpm
Redis: 5.0.7
PostgreSQL: 12.2

The issue you are facing:

After upgrading from Ubuntu 18.04 to Ubuntu 20.04, Nextcloud stopped rendering any pages and, instead, just yields the following error:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

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

Steps to replicate it:

  1. Load any Nextcloud page

The output of your Nextcloud log in Admin > Logging: N/A, since I can’t access the UI

I did change the location of my logfile in config.php to create a new one and added the following options:

  'loglevel' => 0,
  'debug' => true,

However, the log file is created (so, obviously the settings took), but no content is written to it.

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

<?php
$CONFIG = array (
  'instanceid' => 'asdf',
  'passwordsalt' => 'asdf',
  'secret' => 'asdf',
  'trusted_domains' =>
  array (
    0 => 'adsf',
  ),
  'datadirectory' => '/asdf',
  'overwritehost' => 'asdf',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://asdf',
  'dbtype' => 'pgsql',
  'version' => '18.0.3.0',
  'dbname' => 'nextcloud_db',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'asdf',
  'dbpassword' => 'asdf',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'dbindex' => 0,
  ),
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'logfile' => '/asdf/nextcloudtemp.log',
  'loglevel' => 0,
  'debug' => true,
  'theme' => '',
  'updater.release.channel' => 'stable',
);

The output of your Apache/nginx/system log in /var/log/____:
Nothing relevant. Just lines like the below, for a certificate I don’t use for this, which has been in there for a while.

2020/04/29 15:17:58 [warn] 59001#59001: "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/ssl/nginx/default-cert.pem"

The usual root cause of this kind of problem is, that the php components have been updated and that at least one important component is missing. You need to check your php environment and check what messages are logged to the Nextcloud log file. This file can usually be found in the Nextcloud data directory. There is no need to use a gui for it. Everything can be done on the console.

Due to the fact that nearly identical questions are asked at least once a week, I would also recommend to use the search function of the forum to find further information how to solve the problem.

1 Like

So, my issue with troubleshooting this is that there are no entries being made in my log file. As I noted in the first post there, I even tried changing the filename to make sure I was looking in the right place. All that happens is that a file is created with that filename, but no data is ever written to it.

Start nextcloud from the console:

php /var/www/html/nextcloud/index.php
sudo -u www-data /var/www/html/nextcloud/index.php

Post errors.

Same thing as via the browser. Again, no entries in the log.

root@server:/var/www/nextcloud# sudo -u www-data php index.php 
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
root@server:/var/www/nextcloud# php index.php
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
root@server:/var/www/nextcloud# cat /asdf/nextcloudtemp.log 
root@server:/var/www/nextcloud# 

I figured out what this was. The upgrade to 20.04 from 18.04 didn’t install php7.4-pgsql, so there wasn’t a way to access the database. I am mystified as to why it doesn’t actually log anything in that case, though.

1 Like

I think you installed in the old release only the special php-modul-release version.

Correct is to install the meta package “php-pgsql”.

https://packages.ubuntu.com/focal/php-pgsql

With changes from release to the other release the correct package

https://packages.ubuntu.com/bionic/php-pgsql (18.04. LTS)
-> https://packages.ubuntu.com/bionic/php7.2-pgsql
https://packages.ubuntu.com/focal/php-pgsql (20.04 LTS)
-> https://packages.ubuntu.com/focal/php7.4-pgsql

will be installed.

Thanks J-ed, I purged php and re-installed. Now everything back as usual.

1 Like