Internal Server Error: Redis not available for local cache

Since about a day, my NC produces an internal server error (500). I have done nothing, but automatic updates are activated. I am using a VM from TechAndMe with an up to date Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-154-generic x86_64) with Apache2 and PHP7.0.

In my access_log I see the 500 error:

cloud.mydomain.ch:443 172.27.203.37 - - [04/Jul/2019:01:00:11 +0200] "GET / HTTP/1.1" 500 4561 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0"

In my error_log I see this:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/redis.so' - /usr/lib/php/20151012/redis.so: undefined symbol: json_globals in Unknown on line 0
[Thu Jul 04 01:00:11.840478 2019] [:error] [pid 1299] [client 172.27.203.37:43236] {"reqId":"TqbT6nnSGTbkA1fiMhrB","level":3,"time":"2019-07-03T23:00:11+00:00","remoteAddr":"172.27.203.37","user":"--","app":"core","method":"GET","url":"\\/","message":{"Exception":"OC\\\\HintException","Message":"Memcache \\\\OC\\\\Memcache\\\\Redis not available for local cache","Code":0,"Trace":[{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":511,"function":"__construct","class":"OC\\\\Memcache\\\\Factory","type":"->","args":["c90f061dcbc9b229078ba158a355bec0",{"__class__":"OC\\\\Log"},"\\\\OC\\\\Memcache\\\\Redis","\\\\OC\\\\Memcache\\\\Redis","\\\\OC\\\\Memcache\\\\Redis"]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\Memcache\\\\Factory"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["OC\\\\Memcache\\\\Factory"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Server.php","line":986,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\Memcache\\\\Factory"]},{"file":"\\/var\\/www\\/nextcloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\Template\\\\JSCombiner"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/ServerContainer.php","line":132,"function":"query","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["OC\\\\Template\\\\JSCombiner"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/TemplateLayout.php","line":326,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\Template\\\\JSCombiner"]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/TemplateLayout.php","line":160,"function":"findJavascriptFiles","class":"OC\\\\TemplateLayout","type":"::","args":[["vendor\\/core","js\\/merged-template-prepend","search\\/js\\/search","core\\/l10n\\/de","search\\/l10n\\/de","search\\/js\\/searchprovider","js\\/jquery-ui-fixes","js\\/files\\/fileinfo","js\\/files\\/client","js\\/contactsmenu","js\\/contactsmenu_templates"]]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/legacy\\/template.php","line":211,"function":"__construct","class":"OC\\\\TemplateLayout","type":"->","args":["error",""]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Template\\/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/legacy\\/template.php","line":360,"function":"printPage","class":"OC\\\\Template\\\\Base","type":"->","args":[]},{"file":"\\/var\\/www\\/nextcloud\\/index.php","line":61,"function":"printExceptionErrorPage","class":"OC_Template","type":"::","args":[{"__class__":"OC\\\\HintException"},500]}],"File":"\\/var\\/www\\/nextcloud\\/lib\\/private\\/Memcache\\/Factory.php","Line":99,"Hint":"Is the matching PHP module installed and enabled?","CustomMessage":"--"},"userAgent":"Mozilla\\/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko\\/20100101 Firefox\\/67.0","version":"15.0.7.0"}
[Thu Jul 04 01:00:11.842128 2019] [:error] [pid 1299] [client 172.27.203.37:43236] {"reqId":"TqbT6nnSGTbkA1fiMhrB","level":3,"time":"2019-07-03T23:00:11+00:00","remoteAddr":"172.27.203.37","user":"--","app":"PHP","method":"GET","url":"\\/","message":"PHP Startup: Unable to load dynamic library '\\/usr\\/lib\\/php\\/20151012\\/redis.so' - \\/usr\\/lib\\/php\\/20151012\\/redis.so: undefined symbol: json_globals at Unknown#0","userAgent":"Mozilla\\/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko\\/20100101 Firefox\\/67.0","version":"15.0.7.0"}

My NC config file looks like this:

$CONFIG = array (
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '172.27.203.4',
    2 => 'xxx',
    3 => 'xxx',
  ),
  'datadirectory' => '/mnt/ncdata',
  'overwrite.cli.url' => 'xxx',
  'dbtype' => 'mysql',
  'version' => '15.0.7.0',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'instanceid' => 'xxx',
  'appstore.experimental.enabled' => 'true',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpport' => 'xxx',
  'mail_smtphost' => 'xxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'xxx',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0,
    'dbindex' => 0,
    'password' => 'xxx',
  ),
  'htaccess.RewriteBase' => '/',
  'maintenance' => false,
  'loglevel' => 0,

In my php.ini there are the lines:

opcache.enable=On
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
extension=redis.so

But php -m shows no redis:

[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
ldap
libsmbclient
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
smbclient
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Has anyone an idea, what here is going wrong? And what can I try to fix this problem?
Thanks in advance

The most relevant information comes from your error_log where you can read that the PHP module couldn’t be loaded because an unresolved symbol. This means that you’re using a wrong version of the module or a required library couldn’t be found.

You should reinstall the module and make sure that all its dependencies are installed too.

Additionally it would be worse to search this forum for related requests because similar questions have already been asked and answered multiple times.

Thanks for your respond. Yesterday I search for about 8 hours in my logs, with google and in this forum, but I didn’t find a solution. I have uninstalled redis (pecl uninstall redis) and reinstalled it (pecl install redis) without any problems. But the behaviour is the same.

A search for “redis.so: undefined symbol: json_globals” dosn’t give any useful result. Only results for other “symbols”. I tried many of these solutions.

For now I’ve no more ideas, what I can do. Is there a way to debug the start of the php modul “redis”? Does someone know what “json_globals” points to?

I think, some other users should have the same problem, because I use a (than) official VM and didn’t touch it exept that I activated the automatic update and letsencrypt. I have no idea, why that problem appears. Maybe someone can tell me, how I can find out the history of updates?

The only result, that I found for “symbol: json_globals”, ist here: https://github.com/swoole/phpx/issues/41
But neither I can read chinese nor has that something to do with redis.

As I wrote, the module requires a library to be installed or updated. Unfortunately I’m not using Ubuntu 16 LTS so that I cannot the commands to be executed to get the right libraries installed, but you can check the requirements using the following command:

ldd /usr/lib/php/20151012/redis.so

BTW, Nextcloud 15 is the latest version which supports PHP 7.0. I don’t believe that Ubuntu 16 supports newer PHP versions, so it would be worse to upgrade your system to a version which supports PHP 7.2 and newer in the near future :wink:

Thanks for this command. Result looks like this:

ldd -v /usr/lib/php/20151012/redis.so 
	linux-vdso.so.1 =>  (0x00007ffd4455a000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe6a9841000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe6a9e9d000)

	Version information:
	/usr/lib/php/20151012/redis.so:
		libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib/x86_64-linux-gnu/libc.so.6
		libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
		libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
	/lib/x86_64-linux-gnu/libc.so.6:
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2

I don’t see any missing library. What do you think about that?

The libraries exist on the system:

root@cloud:~# ll /lib/x86_64-linux-gnu/libc.so.6 
lrwxrwxrwx 1 root root 12 Feb  5 21:10 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.23.so*
root@cloud:~# ll /lib64/ld-linux-x86-64.so.2 
lrwxrwxrwx 1 root root 32 Feb  5 21:10 /lib64/ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.23.so*

And these are the real libraries:

root@cloud:~# ll /lib/x86_64-linux-gnu/libc-*
-rwxr-xr-x 1 root root 1868984 Feb  5 21:11 /lib/x86_64-linux-gnu/libc-2.23.so*
root@cloud:~# ll /lib/x86_64-linux-gnu/ld-*
-rwxr-xr-x 1 root root 162632 Feb  5 21:11 /lib/x86_64-linux-gnu/ld-2.23.so*
lrwxrwxrwx 1 root root     10 Feb  5 21:10 /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -> ld-2.23.so*

Is it possible, that I have the wrong version? I have no experience with libraries.

Thanks for pointing that out. I’ve already thought about an upgrade. But I don’t want to upgrade from a faulty instance. Probably I will test it on a clone, but actually I havn’t enougth time.

Hi,
we hit the same problem today as our Nextcloud VM update cron job runs on Monday morning.
I’m not an expert but it looks to me that in pecl redis was updated to version 5.0.0 on July 2nd and seems to be no longer compatible (or contains a bug?).
See:
https://pecl.php.net/package-stats.php?pid=935&rid=&cid=7

We downgraded redis to the previous stable release 4.3.0 and the server is now working again.
$ pecl uninstall redis
$ pecl install redis-4.3.0
$ reboot

I filed an issue vs Nextcloud VM. Let’s see what the outcome will be:

HTH & HAND,
Stefan

This solves my problem too. Thank you very much for help @sfrankcc !!