Internal Server Error after Ubuntu-Update

Nextcloud version (eg, 29.0.5): 29.0.7.1
Operating system and version (eg, Ubuntu 24.04): Ubuntu 24.04.1 LTS
Apache or nginx version (eg, Apache 2.4.25): nginx version: nginx/1.24.0 (Ubuntu)
PHP version (eg, 8.3): php-fpm8.3

The issue you are facing:

I installed my nextcloud under lubuntu and ran it for years without any problems. After upgrading to Lubuntu 24.04 LTS, it could not be started at first because php-fpm was not installed for some reason. After I installed and configured php-fpm8.3, I get the following error message when I call my nextcloud domain:
‘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. sudo systemctl restart nginx php8.3-fpm
  2. Access my nextcloud domain via firefox

The output of your Nextcloud log in Admin > Logging:

Sorry, I can't access the web interface.

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

<?php
$CONFIG = array (
  'passwordsalt' => 'MySalt',
  'secret' => 'MySecret',
  'trusted_domains' => 
  array (
    0 => 'example.com',
  ),
  'datadirectory' => '/var/nc_data',
  'dbtype' => 'mysql',
  'version' => '29.0.7.1',
  'overwrite.cli.url' => 'https://example.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/var/run/mysqld/mysqld.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'instanceid' => 'MyInstanceID',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'MyDBpassword',
  'installed' => true,
  'activity_expire_days' => 14,
  'auth.bruteforce.protection.enabled' => true,
  'blacklisted_files' => 
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
  ),
  'cron_log' => true,
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\Movie',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
  ),
  'filesystem_check_changes' => 0,
  'filelocking.enabled' => 'true',
  'htaccess.RewriteBase' => '/',
  'integrity.check.disabled' => false,
  'knowledgebaseenabled' => false,
  'logfile' => '/var/nc_data/nextcloud.log',
  'loglevel' => 2,
  'logtimezone' => 'Europe/Berlin',
  'default_phone_region' => 'DE',
  'log_rotate_size' => 104857600,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwriteprotocol' => 'https',
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'quota_include_external_storage' => false,
  'share_folder' => '/Shares',
  'skeletondirectory' => '',
  'theme' => '',
  'trashbin_retention_obligation' => 'auto, 7',
  'updater.release.channel' => 'stable',
  'mail_from_address' => 'nextcloudadmin',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'example.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.example.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'me@example.com',
  'mail_smtppassword' => 'MySMTPpassword',
  'mail_smtpsecure' => 'ssl',
  'app_install_overwrite' => 
  array (
    0 => 'music',
    1 => 'ocsms',
    2 => 'documentserver_community',
    3 => 'unsplash',
  ),
);

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

2024/10/09 04:08:50 [error] 49338#49338: *1060 access forbidden by rule, client: 5.36.12.193, server: example.com, request: "GET /lib/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 04:08:51 [error] 49338#49338: *1060 access forbidden by rule, client: 5.36.12.193, server: example.com, request: "GET /lib/phpunit/phpunit/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 04:08:52 [error] 49338#49338: *1060 access forbidden by rule, client: 5.36.12.193, server: example.com, request: "GET /lib/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 04:08:53 [error] 49338#49338: *1060 access forbidden by rule, client: 5.36.12.193, server: example.com, request: "GET /lib/phpunit/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 04:08:54 [error] 49338#49338: *1060 access forbidden by rule, client: 5.36.12.193, server: example.com, request: "GET /lib/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 04:09:03 [error] 49338#49338: *1060 access forbidden by rule, client: 5.36.12.193, server: example.com, request: "GET /tests/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 09:27:12 [error] 49338#49338: *2074 access forbidden by rule, client: 78.153.138.177, server: example.com, request: "GET /.env HTTP/1.1", host: "91.44.19.180"
2024/10/09 14:56:21 [error] 49338#49338: *3207 access forbidden by rule, client: 94.124.189.247, server: example.com, request: "GET /lib/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 14:56:22 [error] 49338#49338: *3207 access forbidden by rule, client: 94.124.189.247, server: example.com, request: "GET /lib/phpunit/phpunit/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 14:56:22 [error] 49338#49338: *3207 access forbidden by rule, client: 94.124.189.247, server: example.com, request: "GET /lib/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 14:56:22 [error] 49338#49338: *3207 access forbidden by rule, client: 94.124.189.247, server: example.com, request: "GET /lib/phpunit/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 14:56:22 [error] 49338#49338: *3207 access forbidden by rule, client: 94.124.189.247, server: example.com, request: "GET /lib/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"
2024/10/09 14:56:25 [error] 49338#49338: *3207 access forbidden by rule, client: 94.124.189.247, server: example.com, request: "GET /tests/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", host: "91.44.19.180:443"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"BoRdQ0UAnkGByImASZcN","level":3,"time":"2024-10-09T20:45:27+02:00","remoteAddr":"91.66.19.180","user":"--","app":"core","method":"GET","url":"/index.php/204","message":"Exception thrown: Doctrine\\DBAL\\Exception","userAgent":"Mozilla/5.0 (Linux) mirall/3.11.0git (Nextcloud, ubuntu-6.8.0-45-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"29.0.7.1","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: could not find driver","Code":0,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":453,"function":"connect","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":411,"function":"getDatabasePlatformVersion","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":318,"function":"detectDatabasePlatform","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":200,"function":"getDatabasePlatform","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":121,"function":"getDatabasePlatform","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":1239,"function":"expr","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":264,"function":"loadConfig","class":"OC\\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":1380,"function":"searchValues","class":"OC\\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":131,"function":"getValues","class":"OC\\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":152,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":234,"function":"getInstalledApps","class":"OC\\App\\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"getEnabledApps","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":714,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":1189,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":47,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/DB/Connection.php","Line":167,"CustomMessage":"Exception thrown: Doctrine\\DBAL\\Exception"}}

When you reinstalled PHP did you also re-install all the required modules?

Could please you run the php-updater script and provide the output of installed packages here

What is the database you are using: MySQL/MariaDB or PostgreSQL?
It looks like not all required php-modules are installed, like php8.3-mysql (for MySQL/MariaDB) or php8.3-pgsql (for PostgreSQL):


ernolf

Here is the output of the script:

.. loading modules - dependency
  Dependency not met!

  missing dependencies:
  ==============================================================================
  Bynary          Package         Description
  ------------------------------------------------------------------------------
  apt-file        apt-file        Search for files within Debian packages
  ccdiff          ccdiff          Colored Character Diff
  ------------------------------------------------------------------------------

I allowed the script to install the packages apt-file ccdiff libapt-pkg-perl libregexp-assemble-perl.

Then I installed the necessary php modules according to PHP Modules & Configuration — Nextcloud latest Administration Manual latest documentation - there were indeed some missing, thanks for the tip.

After that I was able to start my nextcloud again :-). Many thanks for the help.

I have one more question. I ran the php-updater script again and got this output:

==============================================================================                                                                                                                                                   
 actual PHP related packages installed and managed by dpkg
X    Package                Version                                       Status                                                                                                                                                   
 ------------------------------------------------------------------------------                                                                                                                                                   
  - php8.3-apcu            5.1.24-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: apcu                                                                                                                                                                                                        
  - php8.3-bcmath          8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: bcmath                                                                                                                                                                                                      
  - php8.3-bz2             8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: bz2                                                                                                                                                                                                         
SAPI php8.3-cli             8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \php binary /usr/bin/php8.3 <ACTIVE> linked to generic /usr/bin/php                                                                                                                                                           
  - php8.3-common          8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im                                                                                                                                                     
    \included modules: calendar ctype exif ffi fileinfo ftp gettext iconv pdo                                                                                                                                                     
      phar posix shmop sockets sysvmsg sysvsem sysvshm tokenizer                                                                                                                                                                  
  - php8.3-curl            8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: curl                                                                                                                                                                                                        
SAPI php8.3-fpm             8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \listening on unix socket /run/php/php8.3-fpm.sock <<NOT CONNECTED                                                                                                                                                            
  - php8.3-gd              8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im                                                                                                                                                     
    \included module: gd                                                                                                                                                                                                          
  - php8.3-gmp             8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: gmp                                                                                                                                                                                                         
  - php8.3-igbinary        3.2.16-3+ubuntu24.04.1+deb.sury.org+1           im
    \included module: igbinary                                                                                                                                                                                                    
  - php8.3-imagick         3.7.0-5+ubuntu24.04.1+deb.sury.org+2            im
    \included module: imagick                                                                                                                                                                                                     
  - php8.3-intl            8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: intl                                                                                                                                                                                                        
  - php8.3-ldap            8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: ldap                                                                                                                                                                                                        
  - php8.3-mbstring        8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: mbstring                                                                                                                                                                                                    
  - php8.3-mysql           8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included modules: mysqli mysqlnd pdo_mysql                                                                                                                                                                                   
  - php8.3-opcache         8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: opcache                                                                                                                                                                                                     
  - php8.3-readline        8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: readline                                                                                                                                                                                                    
  - php8.3-redis           6.0.2-1+ubuntu24.04.1+deb.sury.org+2            im
    \included module: redis                                                                                                                                                                                                       
  - php8.3-smbclient       1.1.1-1+ubuntu24.04.1+deb.sury.org+2            im
    \included module: smbclient                                                                                                                                                                                                   
  - php8.3-sqlite3         8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included modules: pdo_sqlite sqlite3                                                                                                                                                                                         
  - php8.3-xml             8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included modules: dom simplexml xml xmlreader xmlwriter xsl                                                                                                                                                                  
  - php8.3-zip             8.3.12-1+ubuntu24.04.1+deb.sury.org+1           im
    \included module: zip                                                                                                                                                                                                         
  - php-common             2:95+ubuntu24.04.1+deb.sury.org+1               im
  - php-redis              6.0.2-1+ubuntu24.04.1+deb.sury.org+2            im                                                                                                                                                     
 ------------------------------------------------------------------------------                                                                                                                                                   
 Status: - First letter (Desired Action):    - Second letter (Package Status):
           u=Unknown - i=Install - h=Hold      a=Automatic - m=Manual                                                                                                                                                             
 ------------------------------------------------------------------------------                                                                                                                                                   
 You can call this list with:     php-updater --list-installed
 ------------------------------------------------------------------------------         

I am wondering about this line:

SAPI php8.3-fpm 8.3.12-1+ubuntu24.04.1+deb.sury.org+1 im
     \listening on unix socket /run/php/php8.3-fpm.sock <<NOT CONNECTED 

In /var/log/nginx/error.log I have no more error messages, but in /var/nc_data/nextcloud.log I find:

{"reqId":"KBHw7txz8Fmz2gnbxjnG","level":3,"time":"2024-10-10T05:05:35+02:00","remoteAddr":"91.66.19.180","user":"--","app":"index","method":"GET","url":"/index.php/204","message":"Call to undefined function simplexml_load_string()","userAgent":"Mozilla/5.0 (Linux) mirall/3.11.0git (Nextcloud, ubuntu-6.8.0-45-generic ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"29.0.7.1","exception":{"Exception":"Error","Message":"Call to undefined function simplexml_load_string()","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":727,"function":"parse","class":"OC\\App\\InfoParser","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":72,"function":"getAppInfo","class":"OC\\App\\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":157,"function":"buildAppNamespace","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":119,"function":"registerAutoloading","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":714,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":1189,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":47,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/App/InfoParser.php","Line":67,"message":"Call to undefined function simplexml_load_string()","exception":{},"CustomMessage":"Call to undefined function simplexml_load_string()"}}

Is it necessary to fix this?

Great :tada:

So this information is obviously not correct in your case.
This can happen if the nginx configuration file is in a non-standard location or uses an unusual syntax
Here is the place in the code where this is analyzed:

I would be very grateful if you provide me your nginx configuration and where it is located in your usecase, so I can redesign the test so that it will detect such configurations in future.


Much and good luck,
ernolf

PHP module SimpleXML seems to maybe be missing?

here is the content of /etc/nginx/nginx.conf

user www-data;
worker_processes auto;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on; use epoll;
}
http {
server_names_hash_bucket_size 64;
proxy_headers_hash_bucket_size 128;
upstream php-handler {
server unix:/run/php/php8.3-fpm.sock;
}
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
set_real_ip_from 127.0.0.1;
set_real_ip_from 192.168.178.110;
# das ist der IP-Bereich Ihres privaten / firmen Netzwerks
real_ip_header X-Forwarded-For;
real_ip_recursive on;
add_header X-Robots-Tag "noindex, nofollow" always;
include /etc/nginx/mime.types;
include /etc/nginx/proxy.conf;
include /etc/nginx/ssl.conf;
include /etc/nginx/header.conf;
include /etc/nginx/optimization.conf;
default_type application/octet-stream;
sendfile on;
send_timeout 3600;
tcp_nopush on;
tcp_nodelay on;
open_file_cache max=500 inactive=10m;
open_file_cache_errors on;
keepalive_timeout 65;
reset_timedout_connection on;
server_tokens off;
resolver 192.168.178.1 valid=30s;
# das ist die IP des lokalen (127.0.0.53) oder globalen DNS Servers (bspw. die IP I>
resolver_timeout 5s;
include /etc/nginx/conf.d/*.conf;
}

Thank you for your support!

Thank you for the hint. In my case the module php8.3-xml was already installed. Strangely enough, the error message has not reappeared. I will keep an eye on this.

My values are as you suggested.

Thank you very much for that information. It showed me where I had to make improvements.
At this point in the script, it was assumed that all files would reside in the standard paths provided for them, so in this case, for example, a file “nextcloud.conf” in the directory
/etc/nginx/sites-enabled/
This directory is normally included in the nginx.conf and one normally doesn’t make changes directly in that nginx.conf, but in files in included directories, which makes everything much easier to maintain.
Nevertheless, every admin is of course free to set up their server as they wish and you are propably not the only one who does it that way, so I made the underlying algorithm more intelligent. It shouldn’t actually provide any more incorrect information now.

You can now start the script again, no update is required, it will automatically detect that the corresponding module has been updated and replace it.

The output should now be as you expected.

Thanks again!


Much and good luck,
ernolf

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.