Internal Server Error - I think database related

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.6.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • 24.04.2 LTS
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.58 (Ubuntu)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me - I wasn’t sure what this was. I google around and don’t believe I use one, but I could be wrong.
  • PHP version (e.g, 8.3):
    • PHP 8.1.31 (cli)
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • After doing some updates and working to clear some errors
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • bare metal, I believe
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Nextcloud installation is nonresponsive. I get an internal server error. You can see it at https://stevenrushing.com/cloud.

Here are some of the things I did leading up to the error:

Did a PHP update from 7.4 to 8.1. Did a Nextcloud update via GUI from 25 to 30. Did an OS upgrade from 20.04 to 24.04. Tested everything and everything appeared to be working at this point.

I noticed after all this work that I was unable to update my account profile location, email, date of birth, etc. I looked at the database on that account and compared it to a brand new account and it was very different. I ended up manually altering the database and it allowed me to change things in the gui going forward. This was the command I ran:

SET data = '{
    "displayname": {"value":"Steven Rushing","scope":"v2-federated","verified":"0"},
    "address": {"value":"Your-New-Address","scope":"v2-local","verified":"0"},
    "website": {"value":"https://stevenrushing.com","scope":"v2-local","verified":"0"},
    "email": {"value":"steven@stevenrushing.com","scope":"v2-federated","verified":"0"},
    "avatar": {"value":"","scope":"v2-federated","verified":"0"},
    "phone": {"value":"+14323121432","scope":"v2-local","verified":"0"},
    "twitter": {"value":"","scope":"v2-local","verified":"0"},
    "fediverse": {"value":"","scope":"v2-local","verified":"0"},
    "organisation": {"value":"","scope":"v2-local","verified":"0"},
    "role": {"value":"","scope":"v2-local","verified":"0"},
    "headline": {"value":"","scope":"v2-local","verified":"0"},
    "biography": {"value":"","scope":"v2-local","verified":"0"},
    "birthdate": {"value":"1981-11-05T00:00:00.000Z","scope":"v2-local","verified":"0"},
    "profile_enabled": {"value":"1","scope":"v2-local","verified":"0"}
}' 
WHERE uid = 'stevenrushing';

This appeared to me to work, but I’m thinking it might be related to what is going on. I don’t know.

I then started working through some of the errors on the main page.

For the ocm provider error I did this:

and changed
      AllowOverride All
    Require all granted

In the directory brackets. Then:

sudo nano /etc/apache2/sites-available/nextcloud.conf

and in mod rewrite

 RewriteEngine on
RewriteRule ^/ocm-provider /index.php [QSA,L]

And that cleared that error. The next error was no maintenance window so I set a maintenance window and that worked, made that error go away.

I then got mimetype errors and to clear that I ran:

sudo -u www-data php /var/stevenrushing.com/cloud/occ maintenance:repair --include-expensive

Then this error:

Some app directories are owned by a different user than the web server one. This may be the case if apps have been installed manually. Check the permissions of the following app directories: /var/www/stevenrushing.com/cloud/apps/epubreader /var/www/stevenrushing.com/cloud/apps/wopi

And to fix that I did:

ls -l /var/www/stevenrushing.com/cloud/apps/ | grep 'epubreader\|wopi'
sudo chown -R www-data:www-data /var/www/stevenrushing.com/cloud/apps/epubreader
sudo chown -R www-data:www-data /var/www/stevenrushing.com/cloud/apps/wopi
sudo find /var/www/stevenrushing.com/cloud/apps/epubreader -type d -exec chmod 755 {} \;
sudo find /var/www/stevenrushing.com/cloud/apps/epubreader -type f -exec chmod 644 {} \;
sudo find /var/www/stevenrushing.com/cloud/apps/wopi -type d -exec chmod 755 {} \;
sudo find /var/www/stevenrushing.com/cloud/apps/wopi -type f -exec chmod 644 {} \;

Up to this point everything looked like it was working appropriately. I can’t swear I tested everything, but I was regularly refreshing the page with the errors and it kept coming up without the errors, so I figured they were fixed.

This is the next error, the last one before everything broke:

The PHP OPcache module is not properly configured. The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply “opcache.interned_strings_buffer” to your PHP configuration with a value higher than “8”… For more details see the documentation :arrow_upper_right:.

Documentation said that this was fixed in Apache’s php.ini file. I updated the appropriate line and verified it was updated.

steven@stevenrushing:~$ php -i | grep opcache.interned_strings_buffer
opcache.interned_strings_buffer => 32 => 32

But it wasn’t updating on the page showing all the errors. The error wouldn’t go away. So I ran:

sudo systemctl restart apache2
sudo systemctl restart php8.1-fpm
php -r 'opcache_reset();' **# this might be my problem right here**
sudo -u www-data php /var/www/stevenrushing.com/cloud/occ maintenance:repair
sudo -u www-data php /var/www/stevenrushing.com/cloud/occ maintenance:mode --off
sudo -u www-data php /var/www/stevenrushing.com/cloud/occ config:system:set opcache.interned_strings_buffer --value="32"

I never recovered from here. I did all kinds of stuff, enough that I don’t remember it all and didn’t document as well as normal because I was panicking. So much.

Steps to replicate it (hint: details matter!):

I can’t really replicate it, it just is at this point. Go to stevenrushing.com/cloud and you will see it.

Log entries

nextcloud.log - Pastebin.com - nextcloud.log

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

https://pastebin.com/hzYsd7kA - apache log

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

PASTE

Web server / Reverse Proxy

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

PASTE HERE

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocjgpb3yndyb',
  'passwordsalt' => '/yFnh4kcoo2HB8Qgu77NLXhcu3pZXX',
  'secret' => 'LKuO1b9NUi75YFdzSafrxQIw/I/u28LoA0VcbyeX24dSXpv3',
  'trusted_domains' => 
  array (
    0 => 'stevenrushing.com',
    2 => 'www.stevenrushing.com',
  ),
  'datadirectory' => '/media/nextcloud',
  'dbtype' => 'mysql',
  'version' => '30.0.6.2',
  'overwrite.cli.url' => 'https://stevenrushing.com/cloud',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => [redacted],
  'installed' => true,
  'maintenance' => false,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'admin',
  'mail_domain' => 'worshipinaviano.com',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpport' => '587',
  'mail_smtphost' => 'smtp.dreamhost.com',
  'mail_smtpname' => 'admin@worshipinaviano.com',
  'mail_smtppassword' => [redacted],
  'maintenance_window_start' => '3',

At this point I don’t know if this will get a response, but wanted to leave a comment so that folk know that I am still watching the topic.

Alternatively to trying to fix this issue, I am open to a fresh install. I’m thinking it might be required at this point.

The “No such file or directory” from DBAL suggests a problem connecting via the PHP database driver.

Check:

  • MySQL / MariaDB service status
  • Whether you have the appropriate PHP modules installed (when you upgrade PHP versions you have to typically re-install modules) docs