After PHP upgrade on Laravel Forge server, error ‘Please make sure the PHP Redis extension is installed and enabled’

Background

An older Ubuntu 20.04 server running Laravel Forge was upgraded using apt upgrade. Both Sentry and Bugsnag started reporting Redis error and tailing the log file of a critical always on site showed this message:

Please make sure the PHP Redis extension is installed and enabled

These error repeated almost every 30 seconds and the server’s performance was suffering.

Since ‘nothing had changed’ the next steps were to Google the problem, bring up a simulation, and then fix it. We’re putting this ‘nothing has changed’ as indicating no source code had changed.

Since Forge can have many different PHP versions and our gut told us that the PHP Redis library must be missing, that was one of the first things we checked. We noted PHP 8.1.

On the command line the PHP version was 8.1. Checking for Redis library should be trivial, but just trying to re-install it.

First we remember this sage some time ago, so we use the history command to see if there had been previous manual attempts of fixing the Laravel forge server:

sudo -i
history | grep php

This showed a ton of work before trying to get Redis working, e.g.:

service redis status
apt-get install php-redis
apt-get install predis-predis
php -m | grep -E 'redis|igbinary'
sudo apt purge php-redis
php -i | grep redis
echo "extension=redis.so" > /etc/php/7.4/mods-available/redis.ini
sudo ln -s /etc/php/7.4/mods-available/redis.ini /etc/php/7.4/fpm/conf.d/30-redis.ini >/dev/null 2>&1;
service redis-server status
tail -f /var/log/redis/redis-server.log

Finally after a long stressful wait the error goes away.

Conclusion: Forge server’s apt upgrade worked but there was about 20 minutes of queue downtime.

 

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top