Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mikefolsom's avatar

Forge: Changed PHP version and am getting Redis error

Greetings, it's been awhile!

I recently provisioned a new server on DigitalOcean with PHP 7.3 in order to move a Laravel 5.3 app from another hosting provider. The app was experiencing some errors, so I downgraded the PHP version to 7.2 thinking this might solve them. As it turns out, upgrading the Laravel app to 5.4 solved the problems, but Redis seems to have gotten hosed in the process. Every time I deploy now, I get this message:

PHP Warning:  PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20170718/redis.so (/usr/lib/php/20170718/redis.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/redis.so.so (/usr/lib/php/20170718/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Any suggestions for resolving this?

As a side note, I tried upgrading back to PHP 7.3 but running php -v in the terminal still indicates 7.2:

PHP 7.2.24-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 24 2019 18:29:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Thanks!

0 likes
2 replies
jonassiewertsen's avatar

I just had the same error yesterday. Setting up a fresh Server with 7.3 did remove the warning, so the update has been the problem in my case. But then you would need to move your application. I don't know if that is an option for you.

As I could read me through, sometimes the error could be resolved with updating all server packages, but not in my case. As well did I test a few things and everything did run smoothly, so it seems that you could ignore the warning as written in another forum which link i forgot. But yeah, it feels wrong to do so ...

If you can and want, move your project to a fresh forge server with php 7.3

XediDC's avatar

Similar to this, I had the same Redis error going from 7.3->7.4 with Forge.

This fixed it:

sudo apt install php-redis

Check your cli & fpm conf.d directories for a newer duplicate redis entry though. (or if you get "PHP Warning: Module 'redis' already loaded in Unknown on line 0")

In that case you probably need to:

sudo rm /etc/php/7.4/cli/conf.d/20-redis.ini

sudo rm /etc/php/7.4/fpm/conf.d/20-redis.ini

...and restart FPM.

Also, make sure the PHP CLI is actually using the correct PHP version. In my case as yours, Forge failed this part and the CLI was still 7.3.

php -v

If incorrect...

sudo update-alternatives --config php

...and pick the correct PHP version ("manual mode" if their is more than one...but it might need to be auto mode to change correctly in the future? Not sure on that part.).

3 likes

Please or to participate in this conversation.