After updating Ubuntu Server LTS I receive PHP Fatal Error

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): 23.0.0.10
Operating system and version (eg, Ubuntu 20.04): Ubuntu Server 20.4.3 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 8.0

The issue you are facing:
After I’ve done a update for the server via
sudo apt-get update && upgrade
a few packages have been kept back. Since they seem to be security updates I decided to run
sudo apt-get --with-new-pkgs upgrade
which worked. Nextcloud still was there, but after a few hours the site wasn’t available anymore.

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

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:


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

<?php
$CONFIG = array (
  'instanceid' => '*****',
  'passwordsalt' => '*****',
  'secret' => '*****',
  'trusted_domains' => 
  array (
    0 => '***.***.***.**',
    1 => '*****.***',
  ),
  'datadirectory' => '/home/data',
  'dbtype' => 'mysql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://***.***.***.**',
  'dbname' => '*****',
  'dbhost' => '*****',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '*****',
  'dbpassword' => '*****',
  'installed' => true,
  'app_install_overwrite' => 
  array (
    0 => 'files_bpm',
    1 => 'weather',
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_from_address' => '*****',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '*****.**',
  'mail_smtphost' => '****.*****.**',
  'mail_smtpport' => '***',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '*****@*****.**',
  'mail_smtppassword' => '*****',
  'mail_smtpsecure' => 'ssl',
  'default_phone_region' => 'DE',
);


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

[Fri Feb 04 08:36:50.294244 2022] [mpm_prefork:notice] [pid 900] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 08:36:50.294304 2022] [core:notice] [pid 900] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 08:37:46.728470 2022] [php:error] [pid 996] [client 217.93.247.112:44866] PHP Fatal error:  Uncaught Doctrine\\DBAL\\Exception: Failed to connect to the database: An exception occurred in the driver: could not find dr>
[Fri Feb 04 08:41:45.427134 2022] [mpm_prefork:notice] [pid 900] AH00169: caught SIGTERM, shutting down
[Fri Feb 04 08:41:45.567038 2022] [mpm_prefork:notice] [pid 2501] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 08:41:45.567128 2022] [core:notice] [pid 2501] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 11:30:48.324705 2022] [mpm_prefork:notice] [pid 2501] AH00169: caught SIGTERM, shutting down
[Fri Feb 04 11:30:48.465884 2022] [mpm_prefork:notice] [pid 3411] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 11:30:48.465997 2022] [core:notice] [pid 3411] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 11:41:09.602572 2022] [mpm_prefork:notice] [pid 3411] AH00169: caught SIGTERM, shutting down
[Fri Feb 04 11:41:09.749245 2022] [mpm_prefork:notice] [pid 6173] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 11:41:09.749350 2022] [core:notice] [pid 6173] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 11:42:26.849737 2022] [mpm_prefork:notice] [pid 6173] AH00169: caught SIGTERM, shutting down
[Fri Feb 04 11:43:05.041899 2022] [mpm_prefork:notice] [pid 876] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 11:43:05.042740 2022] [core:notice] [pid 876] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 11:47:22.956376 2022] [mpm_prefork:notice] [pid 876] AH00169: caught SIGTERM, shutting down
[Fri Feb 04 11:47:23.094863 2022] [mpm_prefork:notice] [pid 1750] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 11:47:23.094964 2022] [core:notice] [pid 1750] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 11:47:27.947635 2022] [php:error] [pid 1751] [client 217.93.247.112:45386] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 32768 bytes) in /var/www/nextcloud/3rdparty/composer/autol>
[Fri Feb 04 11:47:29.003128 2022] [php:error] [pid 1753] [client 217.93.247.112:45388] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:47:55.036517 2022] [php:error] [pid 1754] [client 217.93.247.112:45390] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 36864 bytes) in /var/www/nextcloud/3rdparty/composer/autol>
[Fri Feb 04 11:48:57.029358 2022] [php:error] [pid 1752] [client 217.93.247.112:45392] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:49:59.038654 2022] [php:error] [pid 1755] [client 217.93.247.112:45394] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:51:01.033102 2022] [php:error] [pid 1751] [client 217.93.247.112:45396] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:52:03.180734 2022] [php:error] [pid 1753] [client 217.93.247.112:45398] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:53:05.031768 2022] [php:error] [pid 1754] [client 217.93.247.112:45400] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:54:07.033492 2022] [php:error] [pid 1752] [client 217.93.247.112:45402] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:54:57.269090 2022] [mpm_prefork:notice] [pid 1750] AH00169: caught SIGTERM, shutting down
[Fri Feb 04 11:54:57.410364 2022] [mpm_prefork:notice] [pid 1876] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Feb 04 11:54:57.410461 2022] [core:notice] [pid 1876] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 04 11:55:09.056252 2022] [php:error] [pid 1878] [client 217.93.247.112:45404] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 32768 bytes) in /var/www/nextcloud/3rdparty/composer/autol>
[Fri Feb 04 11:55:17.869651 2022] [php:error] [pid 1879] [client 217.93.247.112:45406] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:55:18.935065 2022] [php:error] [pid 1880] [client 217.93.247.112:45408] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:55:19.818991 2022] [php:error] [pid 1881] [client 217.93.247.112:45410] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:55:20.883789 2022] [php:error] [pid 1882] [client 217.93.247.112:45412] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:56:11.031128 2022] [php:error] [pid 1878] [client 217.93.247.112:45414] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:57:13.032488 2022] [php:error] [pid 1879] [client 217.93.247.112:45416] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:57:13.239711 2022] [php:error] [pid 1880] [client 217.93.247.112:33762] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:57:55.674386 2022] [php:error] [pid 1881] [client 217.93.247.112:33764] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo>
[Fri Feb 04 11:57:56.507129 2022] [php:error] [pid 1882] [client 217.93.247.112:33766] PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/nextcloud/3rdparty/composer/autolo

The correct way to upgrade our system including packages with changed dependencies would be apt-get dist-upgrade or apt-get full-upgrade.

It seems like that your PHP configuration got messed up somehow. Either apt updated your PHP packages to a new major release or it has somehow overwritten your config files with the default ones. I would try to reinstall PHP the same way you did it, when you first installed it.

The specific PHP error most likely occurs because the memory limit in your php.ini file is set too low.

1 Like

Hi bb77,

I decided to reinstall the complete system following this guide here:
https://apfelcast.com/ubuntu-21-04-nextcloud-installieren-einfache-schritt-fuer-schritt-anleitung/

The only step i didn’t complete is the SSL certificate.

When I try to reach the setup page in the browser for completing the installation, I receive the errors:

Keine Datenbanktreiber (SQLite, MySQL oder PostgreSQL) installiert.
PHP-Modul zip nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul dom nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul XMLWriter nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul XMLReader nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul libxml nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul mbstring nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul GD nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul SimpleXML nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Modul cURL nicht installiert.
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um die Installation des Moduls.
PHP-Module wurden installiert, werden aber als noch fehlend gelistet?
Bitte kontaktieren Sie Ihren Server-Administrator und bitten Sie um den Neustart des Webservers.

But looking at the guide I installed the mentioned php-modules. The only thing I would say is different to my last installation, is that the repository now has the php version 8.1 included.

Can that be the issue?

When I run php -i in console it gives me php 8.1.2 as current version, even if I installed php with the command

sudo apt install php8.0

Try uninstalling php, and then install the packages again, but with the version number

sudo apt remove php*

sudo apt libapache2-mod-php8.0 php8.0-{fpm,gd,mysql,curl,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,redis,smbclient,cli,common,opcache,readline,imagick,redis}
1 Like

Hi bb77,

that does the trick. I wonder why it worked in the first place, when I installed php without the version number…

also very nice to put the modules in brackets, so I don’t need to add the version number for each of it.

Thank you very much!

1 Like

Because PHP8.0 was probably the most recent version at that time. If you install the PHP packages without specifying the versions, it will always install/update to the latest version.

You’re welcome. Glad it fixed the issue. :slight_smile: