PHP Redis not properly working (undefined symbol: igbinary_serialize)
Frequently asked questions
- [x] I have read Frequently Asked Questions
- [x] I have looked at the list of the existing issues (including closed issues) and searched if my issue has been already reported
- [x] I have tried to resolve the issue myself and will describe what I did in clear and concise manner
Describe the bug
Running your latest PHP8.3 Redis and igbinary plugins will give an error of unable to load dynamic library redis.so. This was never an issue before.
This issue seems to be very related to an old (closed) issue from 2019: https://github.com/oerdnj/deb.sury.org/issues/1287
Your understanding of what is happening
PHP Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20230831/redis.so (/usr/lib/php/20230831/redis.so: undefined symbol: igbinary_serialize), /usr/lib/php/20230831/redis.so.so (/usr/lib/php/20230831/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Why would it use /usr/lib/php/20230831/redis.so.so? Are you compiling the php extensions correctly?
What steps did you take to resolve issue yourself before reporting it here
I try to reinstall the relevant php packages.
Expected behavior
No unable to load dynamic library errors whatsoever :).
Distribution (please complete the following information):
- OS: Ubuntu 20.04
- Architecture: amd64
- Repository: Ubuntu PPA
Package(s) (please complete the following information):
php8.3:
Installed: 8.3.11-1+ubuntu22.04.1+deb.sury.org+1
Candidate: 8.3.11-1+ubuntu22.04.1+deb.sury.org+1
Version table:
*** 8.3.11-1+ubuntu22.04.1+deb.sury.org+1 500
500 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
php8.3-redis:
Installed: 6.0.2-1+ubuntu22.04.1+deb.sury.org+1
Candidate: 6.0.2-1+ubuntu22.04.1+deb.sury.org+1
Version table:
*** 6.0.2-1+ubuntu22.04.1+deb.sury.org+1 500
500 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
php8.3-igbinary:
Installed: 3.2.16-1+ubuntu22.04.1+deb.sury.org+1
Candidate: 3.2.16-1+ubuntu22.04.1+deb.sury.org+1
Version table:
*** 3.2.16-1+ubuntu22.04.1+deb.sury.org+1 500
500 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages
100 /var/lib/dpkg/status
Additional context
See previous section. See also a very very very old issue: https://github.com/oerdnj/deb.sury.org/issues/1287
I seems to "resolve" itself, somehow.. I dunno. You might still want to look into this.
I would need the state of the system or exact steps to reproduce this. But my usual experience is that people create redis.conf by hand without meta-headers, so the extensions are not enabled in correct order.
Sorry, redis.conf? Do you really mean the /etc/redis/redis.conf? Or do you actually mean ini files in for example in /etc/php/8.3/fpm/conf.d?
Anyways, I didn't create any of those ini files by hand. This message above did happen after an update, even when using CLI. But since it automagically resolves itself, I'm starting to wonder if it would be some cache related issue.
Like I have opcache enabled (also on CLI).
I meant the PHP version of the config. Can you paste the redis.conf and igbinary.conf links from /etc/php/8.3/*/ and also list their exact file names?
Again, there is no such redis.conf file in those directories (or sub-dirs) in /etc/php/8.3/....
Only a 20-redis.ini file in both the cli/conf.d and in fpm/conf.d/ those are symlinks to mods-available/redis.ini file, with the content:
extension=redis.so
Why would you think there is a redis.conf file within the /etc/php/8.3?
Ok, if there is just a single line with extension=redis.so then you have modified the file and that’s why you are seeing the error. Nothing broken on my side.
That’s exactly what I said in my first messages and you’ve denied that you modified the files. That’s obviously not true, and you’ve just forgotten about it.
Look, stop accusing me; I really didn't add or modify those files. I can proof it, since if you download your deb file for php8.3-redis package from your PPA for Ubuntu 22.04, which is this file: https://launchpad.net/~ondrej/+archive/ubuntu/php/+files/php8.3-redis_6.0.2-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb (see redis related packages if you wish, this is how I found the download link of the deb file).
You can inspect the deb file yourself, and voila! It contains the ini file we are now discussing: etc/php/8.3/mods-available/redis.ini, within the package with the content: extension=redis.so..
Enabling those PHP modules will create a symlink to those ini files, which is actually all looking fine. I still don't believe it has anything to do with these ini files.
Like I said earlier, I suspect some kind of PHP caching (eg. opcache), since it auto-resolved itself after a few minutes.
Hmm, you are right. I apologize. I was convinced it should be there. The priority line should be there, and you did find an actual bug. I’ll fix this with next upload.
To be precise - you are the first one to discover bug of this kind in like 10 years or so, so excuse my reluctance.
Thank you for that.
If you want to get this fixed (as root):
- Run
phpdismod redis - Add:
; priority=30and new line to redis.ini - Run
phpenmod redis
This should create link 30-redis.ini instead of 20-redis.ini to ensure correct loading order before igbinary extension.
you are the first one to discover bug of this kind in like 10 years or so
Am I eligible for a bug bounty now? haha 👏🏽
This has been fixed now.