Stupid me messed with php -> Internal Server Error

Nextcloud version (eg, 20.0.5): 23.0.0.10
NextcloudPi version: v1.44.5
Operating system and version (eg, Ubuntu 20.04): Debian GNU/Linux 10. 5.10.63-v8+ (aarch64)
Apache or nginx version (eg, Apache 2.4.25): Server version: Apache/2.4.38 (Debian)
PHP version (eg, 7.4): PHP 7.4.26 (cli) (built: Nov 22 2021 09:47:04) ( NTS ) Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.26, Copyright (c), by Zend Technologies

The issue you are facing:

My server was working, but after updating to NC 23.0 it was saying in the settings that I should update PHP so I updated to 8.0. Then I got a

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.. 

I then figured out, that 8.0 was not yet supported, so I tried to downgrade, but I failed.
I think there is something wrong with “redis memchache” but I don’t even no what this is.

Would be really happy if someone could help me out :pleading_face:

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

Steps to replicate it:

  1. Update to php 8.0
  2. fail do downgrade
  3. be stupid

The output of your Nextcloud log in Admin > Logging:

I do not have access anymore

The output of ncp-report:

NextCloudPi diagnostics

NextCloudPi version  v1.44.5
NextCloudPi image    NextCloudPi_11-27-20
OS                   Debian GNU/Linux 10. 5.10.63-v8+ (aarch64)
automount            yes
USB devices          sda sdb
datadir              /media/data/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      143G/477G
rootfs usage         5.8G/118G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      error
HTTPD service        up
PHP service          down
MariaDB service      up
Redis service        up
HPB service          down
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            wlan0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               24min

Nextcloud configuration

An unhandled exception has been thrown:
OCP\HintException: [0]: Memcache \OC\Memcache\Redis not available for local cache (Is the matching PHP module installed and enabled?)

HTTPd logs

[Wed Dec 08 00:00:00.921057 2021] [http2:warn] [pid 1360] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Wed Dec 08 00:00:00.969011 2021] [mpm_prefork:notice] [pid 1360] AH00163: Apache/2.4.38 (Debian) OpenSSL/1.1.1d   configured -- resuming normal operations
[Wed Dec 08 00:00:00.969054 2021] [core:notice] [pid 1360] AH00094: Command line: '/usr/sbin/apache2'
[Wed Dec 08 00:51:33.892175 2021] [mpm_prefork:notice] [pid 1360] AH00169: caught SIGTERM, shutting down
[Wed Dec 08 00:52:14.981410 2021] [:notice] [pid 1091] ModSecurity for Apache/2.9.3 (http://www.modsecurity.org/) configured.
[Wed Dec 08 00:52:14.983012 2021] [:notice] [pid 1091] ModSecurity: APR compiled version="1.6.5"; loaded version="1.6.5"
[Wed Dec 08 00:52:14.983058 2021] [:notice] [pid 1091] ModSecurity: PCRE compiled version="8.39 "; loaded version="8.44 2020-02-12"
[Wed Dec 08 00:52:14.983073 2021] [:warn] [pid 1091] ModSecurity: Loaded PCRE do not match with compiled!
[Wed Dec 08 00:52:14.983086 2021] [:notice] [pid 1091] ModSecurity: LUA compiled version="Lua 5.1"
[Wed Dec 08 00:52:14.983100 2021] [:notice] [pid 1091] ModSecurity: YAJL compiled version="2.1.0"
[Wed Dec 08 00:52:14.983113 2021] [:notice] [pid 1091] ModSecurity: LIBXML compiled version="2.9.4"
[Wed Dec 08 00:52:14.983126 2021] [:notice] [pid 1091] ModSecurity: Original server signature: Apache
[Wed Dec 08 00:52:15.352573 2021] [:notice] [pid 1091] ModSecurity: StatusEngine call: "2.9.3,Apache,1.6.5/1.6.5,8.39/8.44 2020-02-12,Lua 5.1,2.9.4,da"
[Wed Dec 08 00:52:16.729774 2021] [:notice] [pid 1091] ModSecurity: StatusEngine call successfully sent. For more information visit: http://status.modsecurity.org/
[Wed Dec 08 00:52:16.929894 2021] [http2:warn] [pid 1478] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Wed Dec 08 00:52:18.510686 2021] [mpm_prefork:notice] [pid 1478] AH00163: Apache/2.4.38 (Debian) OpenSSL/1.1.1d   configured -- resuming normal operations
[Wed Dec 08 00:52:18.510847 2021] [core:notice] [pid 1478] AH00094: Command line: '/usr/sbin/apache2'

Database logs

2021-12-08  0:52:53 0 [Note] InnoDB: Uses event mutexes
2021-12-08  0:52:53 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-12-08  0:52:53 0 [Note] InnoDB: Number of pools: 1
2021-12-08  0:52:53 0 [Note] InnoDB: Using generic crc32 instructions
2021-12-08  0:52:53 0 [Note] InnoDB: Initializing buffer pool, total size = 1.875G, instances = 1, chunk size = 128M
2021-12-08  0:52:53 0 [Note] InnoDB: Completed initialization of buffer pool
2021-12-08  0:52:53 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-12-08  0:52:54 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-12-08  0:52:54 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-12-08  0:52:54 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-12-08  0:52:54 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-12-08  0:52:54 0 [Note] InnoDB: 10.3.31 started; log sequence number 5518919106; transaction id 11017225
2021-12-08  0:52:54 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-12-08  0:52:54 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-12-08  0:52:54 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-12-08  0:52:54 0 [Note] Reading of all Master_info entries succeeded
2021-12-08  0:52:54 0 [Note] Added new Master_info '' to hash table
2021-12-08  0:52:54 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.31-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 10
2021-12-08  0:53:03 0 [Note] InnoDB: Buffer pool(s) load completed at 211208  0:53:03

Nextcloud logs
##Looked like sensitive information to me, IP and stuff...
##I am happy to provide if necessary.

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

<?php
$CONFIG = array (
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.xxx.xx',
    2 => 'xxxxxxxxxxxxxxx',
    3 => 'xxxxxxxxxxxxxxxxxxxxxx',
    11 => 'xxxxxxxxxxxxxxxxxxxx',
    22 => 'nextcloudpi',
    '' => 'nextcloudpi',
    14 => 'nextcloudpi',
  ),
  'datadirectory' => '/media/data/ncdata',
  'dbtype' => 'mysql',
  'default_phone_region' => 'xx',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://nextcloudpi/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=',
  'installed' => true,
  'instanceid' => 'xxx',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'xxxxxxxxxxxxxxxxxxxxxx',
  ),
  'tempdirectory' => '/media/data/ncdata/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'xxxxxxxxxxxxxxxx',
  'mail_domain' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',

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

see above in HTTPd logs from ncp-report
1 Like

I would start from the error message provided:

Is the matching PHP module installed and enabled?

Not sure if this is the one sudo apt install php8.0-memcached

Or you could restore a backup which I’m sure you have made before messing with your instance…

1 Like

I had almost the same problem. In my case this was caused by missing package php8.0-redis.
Not sure how that happened, but in my case this was solved by installing this.
sudo apt install php8.0-redis.

I came to this conclusion when I commented out:

'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',

and Nextcloud was working again.

I tried what you where suggesting, but it did not work.

I have a Backup, but unfortunately I get an I/O error when trying to restore it. I could build up the stuff manually, but I would like to avoid that.

Thanks for trying to help me (:

Awesome idea.
After commenting out what you said my instance is working again.
Thanks a lot.
Do you know why is that?
I also installed php8.0-redis, but when I comment the two lines again, it is still not working somehow.

yesterday i got the same prob

in my case it was caused by a php update

for a long time i couldnt update debian security because a mistake in sources-list
yesterday i found the correct entry for that in internet and replaced the wrong one

after that i got this error

i figured out that there was 7 new php packeges within the redis
they where out of php 8.1 but i am using 8.0

i started aptitude, killed the 8.1 and replaced with 8.0
then a reboot and everything was fine again

if i do “php -m” it semes the 8.1 packages are there again but its still working

i am using nc 22.2.3

Then it is a Redis configuration problem.
If it was working before, you could check is Redis is running. If you are on Ubuntu:
sudo service redis status
How is Redis found by Nextcloud? Via ip/tcp of sock?

$ php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
imagick
imap
intl
json
ldap
libxml
mbstring
mcrypt
memcached
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

sudo service redis status
Unit redis.service could not be found.

i am on debian bullseye

Difficult to respond because we know little about your system.
What version of php are your using?
php -v

What do the first lines:
sudo php --ri redis
tell you? Is Redis enabled?

now everything is fine for me
only some icons are not correct but that doesnt matter to me.
for example: the green button in /admin/settings/overfiew was a white line on green ground
now there is only the green circle

the contacs button on the top right next to the profile picture is invinceble but still there

at some place i cant remeber was a dark grey circle when i do a mouseover a little red dustbin appears if the mouse is away the dustbin is also gone

maybe all this would be fixed sometimes

i just tryed to help to find out what was wrong so i wrote what was helping me out.
maybe there is someone with more knowlegde who can understand what happens.

sudo phph --ri redis shows this:

sudo php --ri redis

redis

Redis Support => enabled
Redis Version => 5.3.4
Redis Sentinel Version => 0.1
Available serializers => php, json, igbinary
Available compression => lzf, zstd, lz4

Directive => Local Value => Master Value
redis.arrays.algorithm => no value => no value
redis.arrays.auth => no value => no value
redis.arrays.autorehash => 0 => 0
redis.arrays.connecttimeout => 0 => 0
redis.arrays.distributor => no value => no value
redis.arrays.functions => no value => no value
redis.arrays.hosts => no value => no value
redis.arrays.index => 0 => 0
redis.arrays.lazyconnect => 0 => 0
redis.arrays.names => no value => no value
redis.arrays.pconnect => 0 => 0
redis.arrays.previous => no value => no value
redis.arrays.readtimeout => 0 => 0
redis.arrays.retryinterval => 0 => 0
redis.arrays.consistent => 0 => 0
redis.clusters.cache_slots => 0 => 0
redis.clusters.auth => no value => no value
redis.clusters.persistent => 0 => 0
redis.clusters.read_timeout => 0 => 0
redis.clusters.seeds => no value => no value
redis.clusters.timeout => 0 => 0
redis.pconnect.pooling_enabled => 1 => 1
redis.pconnect.connection_limit => 0 => 0
redis.pconnect.echo_check_liveness => 1 => 1
redis.pconnect.pool_pattern => no value => no value
redis.session.locking_enabled => 0 => 0
redis.session.lock_expire => 0 => 0
redis.session.lock_retries => 10 => 10
redis.session.lock_wait_time => 2000 => 2000

So Redis is working then? Or have you disabled it in de config.php?

Somehow it is working for me now, I deleted all the other php packages besides php7.4.
Removed it with sudo apt remove php7.2* && sudo apt remove php7.3* and so on.

Nevertheless… I am running nextcloudpi and getting this Error now when running “sudo ncp-update”:

sudo ncp-update
Downloading updates
Performing updates
Running nc-autoupdate-nc
automatic Nextcloud updates enabled
ls: cannot access '/etc/php/7.3/fpm/conf.d/*-opcache.ini': No such file or directory
ls: cannot access '/etc/php/7.3/cli/conf.d/*-opcache.ini': No such file or directory
NextCloudPi updated to version v1.46.7

So it is still calling php7.3 somehow, I don’t know if this is a problem but my instance is working smoothly again. I think its because ncp is not ready for NC23 or php7.4 yet.

Also I got php log errors (nextcloud log) though, but they are only logged when booting up my instance.
Like this one:

[privacy] Fatal: Error during app loading: LOADING Redis is loading the dataset in memory

GET /apps/news/folders
Fatal	privacy	RedisException: LOADING Redis is loading the dataset in memory

0.    /var/www/nextcloud/lib/private/Memcache/Redis.php - line 55:
    Redis->get()

1.    /var/www/nextcloud/lib/autoloader.php - line 153:
    OC\Memcache\Redis->get()

2.    <<closure>>
    OC\Autoloader->load()

3.    <<closure>>
    spl_autoload_call()

4.    /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php - line 197:
    class_exists()

5.    /var/www/nextcloud/lib/private/legacy/OC_App.php - line 172:
    OC\AppFramework\Bootstrap\Coordinator->isBootable()

6.    /var/www/nextcloud/lib/private/legacy/OC_App.php - line 140:
    OC_App::loadApp()

7.    /var/www/nextcloud/lib/base.php - line 986:
    OC_App::loadApps()

8.    /var/www/nextcloud/index.php - line 36:
    OC::handleRequest()

or this:

[core] Error: LOADING Redis is loading the dataset in memory

GET /

or this

[core] Error: read error on connection to /var/run/redis/redis.sock:0

GET /

Does anyone know if this is a problem? And if so how to fix this? Like I said, my instance is working fine, but I hope this errors are not a security risk somehow, or messing with performance.

sudo php --ri redis shows me the exact same output than @joker_75

Fixed this by purging redis with sudo apt-get purge --auto-remove redis-server php-redis.

Then I reinstalled using this Memory caching — Nextcloud latest Administration Manual latest documentation
and additional this How to Install and configure memory caching using APCu and Redis in Nextcloud. - YouTube

Step 1 : Install APCu and Redis.

sudo apt-get install php-apcu redis-server php redis
sudo service apache2 restart

Step 2: Edit the redis configuration file.

sudo nano /etc/redis/redis.conf

  • Ctrl+w to search “port” and change

port 6379 to 0

  • Then Ctrl+w to search for and uncomment.

unixsocket /var/run/redis/redis.sock

unisocketperm 700

change to

unisocketperm 770

  • Ctrl+x then Y to save and exit

Step 3: Restart.

Step 4: Add the Redis user redis to the www-data group.

sudo usermod -a -G redis www-data

Step 5: Restart Apache.

sudo systemctl restart apache2

Step 6: Start Redis server.

sudo service redis-server start

Step 7: Add the chaching configuration to the Nextcloud config file.

change theconfig.php (/var/www/nextcloud/config/config.php) file like that:

‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis.sock’,
‘port’ => 0,
‘dbindex’ => 0,
‘timeout’ => 1.5,
‘password’ => ‘yoursecret’