phpredis extension doesn't work, unable to load 'redis.so'
Asked Answered
S

6

16

I installed nginx, php, php-fpm, php-pecl-redis by yum.

All of them work but the last one.

When I run /usr/sbin/php-fpm, I got this:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/redis.so' - /usr/lib/php/modules/redis.so: undefined symbol: igbinary_unserialize in Unknown on line 0

I don't know what igbnary_unserialize means and how to fix it.

I checked the redis.so file under right path. I add extension=redis.so to php.ini

PHP version: 5.3.3

PhpRedis version: 2.2.7

Sholem answered 30/11, 2015 at 8:12 Comment(2)
Are you able to get a php_info()?Saundrasaunter
@BobvanLuijt I can get phpinfo(),If you mean that. But I still can not find reids info that pageSholem
F
35

I had the same issue. I'm on Ubuntu 16.04 LTS. Running sudo apt-get install php-igbinary resolved the issue for me. I have other issues, but that's what solved this one.

Fluke answered 19/5, 2017 at 7:36 Comment(5)
After upgrading from php7.0 to 7.1, redis was not working for me.. was scratching my head and doing all stuff said on diff forums ...finally this worked..Thanks Matt!Enkindle
After upgrading to php 7.2 I was having the same issue that fixed it for me. Thank you.Delinquent
This should be the answer :)Overside
Same for me when updating to php7.3 (from 7.0) for an update of Nextcloud (15->16). (Linux Mint Debian Edition).Magnitogorsk
Meanwhile, there's no version for php 7.4; The following additional packages will be installed: php5.6-igbinary php7.0-igbinary php7.1-igbinary php7.2-igbinary php7.3-igbinary php8.0-igbinarySparks
T
17

For people who are upgrading their php from 7.0 to 7.4 like me, and not able to get php-redis working. These are the steps I used after following the answers above.

1) remove Redis

sudo apt purge php-redis

2) Install Igbinary

sudo apt-get install php-igbinary

3) Install php-redis again

sudo apt-get install php-redis

I did the steps above because it seems only php7.0 is recognising the php-redis install but not the currently enabled php7.4

I also recommend removing other versions of PHP if you have should your problem continue unsolved.

Trawler answered 1/5, 2020 at 7:35 Comment(1)
Straight up accurate answer.Impolitic
S
2

Probably an issue with igbinary, is this installed? (try for example: cat /etc/php.d/igbinary.ini).

Here you can find and install igbinary

Saundrasaunter answered 30/11, 2015 at 11:2 Comment(4)
What is the outcome of php_info()?Saundrasaunter
is php_info() a correct function? I got 500 err after insert that.Sholem
What if you -in terminal- type: php php_info();Saundrasaunter
~O~,but i got the same message like in broswer.I'm going to reinstall the environmentSholem
H
2

Related to this bug https://bugs.launchpad.net/ubuntu/+source/php-redis/+bug/1762935

You should remove php-redis from packages: apt purge php-redis , and install it via pecl install redis

You should add "extension=redis.so" to php.ini

and remove redis from config.d in your php directory:

rm /etc/php/7.2/fpm/conf.d/@20-redis.ini

and

rm /etc/php/7.2/cli/conf.d/@20-redis.ini

restart php fpm and you will see that problem solved

Hardboard answered 21/6, 2019 at 9:6 Comment(0)
S
2

On Ubuntu 20 and PHP 7.4 I did this and it worked :

sudo apt purge php-redis 

sudo apt  intall php-redis  php7.4-redis

TEST redis server :

$ php --ri redis
or 
$ redis-cli ping
$ redis-cli info stats
Sorgo answered 7/1, 2022 at 4:57 Comment(0)
D
0

just resolve the same problem:

php-pecl-redis installed by yum will cause this problem. so you need to install the php-redis manually. wget the package and phpize - configure - make ....

Doura answered 28/8, 2016 at 16:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.