[Solved] Internal Server Error 500 after upgrading to Debian 10 Buster

Support intro

Hello,
Since the transition to Debian 10 our nextcloud desperately indicates

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.

Nextcloud version : 16.0.2
Operating system and version : Debian 10 Buster
Apache : Apache2 last version
PHP version : PHP 7.3

Is this the first time you’ve seen this error? Yes

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

$CONFIG = array (
  'instanceid' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'domain.fr',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '16.0.2.1',
  'overwrite.cli.url' => 'https://domain.fr',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'XXXXXXXXX',
  'dbpassword' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'installed' => true,
  'integrity.check.disabled' => true,
  'filelocking.enabled' => false,
  'maintenance' => false,
  'default_language' => 'fr',
  'default_locale' => 'fr_FR',
  'theme' => '',
  'app_install_overwrite' =>
  array (
    0 => 'defaultlinkopen',
    1 => 'occweb',
  ),
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
    'dbindex' => 0,
    'timeout' => 1.5,
  ),
);

The output of your Apache log in /var/log/apache2/error.log:

[Wed Jul 10 02:36:58.106928 2019] [php7:error] [pid 31117] [client XXX.XXX.XXX.XXX:57879] PHP Fatal error:  Uncaught Error: Call to a member function getRequest() 
on null in /var/www/domain.fr/remote.php:49\nStack trace:\n#0 /var/www/domain.fr/remote.php(168)
: handleException(Object(ParseError))\n#1 {main}\n  thrown in /var/www/domain.fr/remote.php on line 49

Due to the fact that Nextcloud relies on a working PHP environment and this is a hard PHP error, I would recommend to check that PHP and all of the required PHP modules are installed correctly.

Hi,
How to you go about doing that check ?

Does a full-upgrade from stretch to buster crush any conf files in the process ?

(And what are the required modules for NC ? )

I’m in the same situation,
Getting
PHP Fatal error , uncaught doctrine, Failed to connect to the database
Having
PHP 7.3.4-2 (cli) (built: Apr 13 2019 19:05:48) ( NTS )
and modules

[PHP Modules]
apc
apcu
bz2
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
imagick
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache

Usually you have two PHP configuration files, one for the CLI, which you checked, and one for the WEB, which can only be checked using a web browser execution a file which contains <?php phpinfo() ?>.
A “failed to connect to the database” message is usually caused by a missing PHP database module. If you search this forum you will find many related questions and solutions.

Hello,

i did it, running in some dependencies problem.
Check my dependencies list General info, Debian Buster (10.0) is now available

was mostly some packages error/missing in my case

The presence of the packages has been checked. Everything is good on this side.

Hello,

try to save your /etc/apache2/.
and your /etc/php/.

Then, do a full purge of php7.x using apt-get purge …
If not working, use aptitude.

When done, same thing with apache2

reinstall all of them in that order: ( even if packages are alredy installed )

prerequist first ( this is one line command ) :

  • apt install apt-transport-https git wget gnupg2 dirmngr lsb-release ssl-cert ca-certificates tree sudo
  • apt install software-properties-common zip unzip screen curl git ffmpeg libfile-fcntllock-perl

apache2 and php

  • apt install libapache2-mod-php7.3 php7.3-cli php7.3-common php7.3-mbstring php7.3-gd php7.3-intl php7.3-xml php7.3-mysql php7.3-zip php7.3-dev php7.3-curl php7.3-fpm php7.3-json php7.3-bz2 php7.3-ldap php-dompdf php-apcu imagemagick php-imagick php-smbclient redis-server php-redis unzip

after that, you may have to take care of ( using saved config files )

  • SSL certs
  • Vhost definitions
  • mpm_prefork php7.3-fpm mpm_event
  • Redis
  • Enable further Apache modules depending of your needs

Enjoy

if apt gets you in troubles, go use aptitude, witch is problem solving for missing/broken dependencies

After dozens of hours of testing, I finally reinstalled nextcloud.

yes, this is another way to do it. But i am sure you fell good, because you spent hours having your brain working.

But you might consider yourself lucky, having not lost data, crashed databased or worst …

We also upgraded from Debian 9 to 10, no issue after upgrading. Just make sure you got all the needed PHP stuff.

regards

apt-get purge

seems a little harsh - why delete all configs?
i just did a stretch -> buster upgrade and even after php7.3-common a lot of php-modules had to re-installed manually. after that, though, nc 15 -> 16 went painlessly as always.
re-installing nc is not an option for me.

hello,

purge because i saved my conf files. Also because and wanted to solve a broken dependency having failed other solution before. And third, because my server was kind of really messed up having mixed several sources ( backport, specifics … ) and having a lot of manual install, and stupid experiments i ve done in the last 2 years…

Purging was a way to restart clean, but not from scratches …

All, I ran into the same today. What helped was to purge all php packages and than reinstall them with the command below. I don’t needed to deinstall apache2. Maybe this information will help people who are searching the web related to this.

1 Like

I did the above. It was not needed to purge php packages.
Just
a2dismod php7.0
and
a2enmod php7.3
was enough. After
service apache2 restart
nextcloud started working again.