Nextcloud PHP redis error - internal server error HTTP 500

Problem 

After the update nextcloud script the Nextcloud VM (Ubuntu 22.04, Nextcloud 32.0.9, PHP 8.2) is down, the webinterfaces shows a an HTTP 500 internal server error


When checking /var/log/apache2/error.log you see:

[Sun May 10 20:38:17.007818 2026] [proxy_fcgi:error] [pid 3221266:tid 140432444835008] [client 172.21.42.211:61182] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught OCP\\HintException: [0]: Memcache OC\\Memcache\\Redis not available for local cache (Is the matching PHP module installed and enabled?)\n\n thrown in /var/www/nextcloud/lib/private/Memcache/Factory.php on line 75'

When running php -r "var_dump(class_exists('Redis'));" you get a false:

root@nxtcldger031:~#
root@nxtcldger031:~# php -r "var_dump(class_exists('Redis'));"
bool(false) 
root@nxtcldger031:~#
root@nxtcldger031:~# php -m | grep redis
root@nxtcldger031:~#

 

Cause

Nextcloud tried to use Redis for local memcache but PHPs Redis extension (php-redis) isn't installed or enabled (anymore, in my case after the nextcloud update script).

The redis package installed from the Ondrej PPA was built against the ondrej-provided igbinary binary ABI/version. The PECL-installed igbinary (and its version/ABI) didn’t satisfy that dependency, producing undefined symbol errors when loading redis.so. 


Temp Solution/Workaround

Solution if your are running Nextcloud 32.0.9 on Ubuntu 22.04 with PHP8.2.31 and Apache2: 
  1. sudo apt install -y php8.2-dev build-essential pkg-config unzip
  2. sudo pecl install igbinary
  3. echo "extension=igbinary.so" | sudo tee /etc/php/8.2/mods-available/igbinary.ini
  4. sudo phpenmod -v 8.2 -s ALL igbinary
  5. sudo pecl uninstall redis || true
  6. sudo pecl install redis
  7. echo "extension=redis.so" | sudo tee /etc/php/8.2/mods-available/redis.ini
  8. sudo phpenmod -v 8.2 -s ALL redis
  9. sudo systemctl restart php8.2-fpm
  10. sudo systemctl restart apache2
  11. php -r "var_dump(function_exists('igbinary_serialize'));"
  12. php -r "var_dump(class_exists('Redis'));"
  13. cd /var/www/nextcloud
  14. sudo -u www-data php occ maintenance:mode --off
root@nxtcldger031:~#
root@nxtcldger031:~# php -r "var_dump(class_exists('Redis'));"
bool(true)
root@nxtcldger031:~# php -m | grep redis
redis
root@nxtcldger031:~#
 
 

Solution for picking redis package from the Ondrej PPA

  1. sudo pecl uninstall igbinary
  2. sudo rm -f /etc/php/8.2/cli/conf.d/20-redis.ini /etc/php/8.2/fpm/conf.d/20-redis.ini /etc/php/8.2/apache2/conf.d/20-redis.ini
  3. sudo find /usr/lib/php -name 'igbinary.so' -o -name 'redis.so' -exec ls -l {} \;
  4. sudo rm -f /usr/lib/php/20220829/igbinary.so /usr/lib/php/20220829/redis.so
  5. sudo find /usr/lib/php -name 'igbinary.so' -o -name 'redis.so' -exec ls -l {} \;
  6. sudo apt install php8.2-igbinary php8.2-redis --reinstall
  7. sudo phpenmod -v 8.2 -s ALL igbinary redis
  8. sudo systemctl restart php8.2-fpm
  9. sudo systemctl restart apache2
  10. php -r "var_dump(function_exists('igbinary_serialize'));"
  11. php -r "var_dump(class_exists('Redis'));"
root@nxtcldger031:~#
root@nxtcldger031:~# php -r "var_dump(class_exists('Redis'));"
bool(true)
root@nxtcldger031:~# php -m | grep redis
redis
root@nxtcldger031:~#
 

 

No comments:

Post a Comment

Nextcloud PHP redis error - internal server error HTTP 500

Problem  After the update nextcloud script the Nextcloud VM (Ubuntu 22.04, Nextcloud 32.0.9, PHP 8.2) is down, the webinterfaces shows a an ...