docker-images-php: PHP Startup: Unable to load dynamic library 'redis.so'

Expected Behavior

Enable redis support in PHP in thecodingmachine/php:7.4-v3-slim-fpm

Current Behavior

Container crashing on start or giving constant errors on load.

Possible Solution

As discussed in #200 maybe add delay or other order of loading

Steps to Reproduce (for bugs)

php/Dockerfile:

ARG PHP_EXTENSIONS="apcu mysqli pdo_mysql ldap redis intl imap"
ARG NODE_VERSION=10
FROM thecodingmachine/php:7.4-v3-slim-fpm as php7.4-base-node10

docker-compose.yml:

  php:
    container_name: 'php'
    build:
      context: ./php
    environment:
      PHP_EXTENSION_REDIS: 1
      PHP_EXTENSION_GETTEXT: 1
      PHP_EXTENSION_PDO: 1
      PHP_EXTENSION_PDO_MYSQL: 1
      PHP_EXTENSION_LDAP: 1
      PHP_EXTENSION_INTL: 1

docker-compose up

php      | PHP Warning:  PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20190902/redis.so (/usr/lib/php/20190902/redis.so: undefined symbol: igbinary_serialize), /usr/lib/php/20190902/redis.so.so (/usr/lib/php/20190902/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
php      | /usr/local/bin/docker-entrypoint-as-root.sh: line 129: supercronic: command not found
php      | PHP Warning:  PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20190902/redis.so (/usr/lib/php/20190902/redis.so: undefined symbol: igbinary_serialize), /usr/lib/php/20190902/redis.so.so (/usr/lib/php/20190902/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
php      | bash: line 2: syntax error near unexpected token `('
php      | bash: line 2: `Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20190902/redis.so (/usr/lib/php/20190902/redis.so: undefined symbol: igbinary_serialize), /usr/lib/php/20190902/redis.so.so (/usr/lib/php/20190902/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0'

When disabling PHP_EXTENSION_REDIS: 0 it starts:

php      | [16-Oct-2020 09:34:05] NOTICE: fpm is running, pid 1845
php      | [16-Oct-2020 09:34:05] NOTICE: ready to handle connections
php      | [16-Oct-2020 09:34:05] NOTICE: systemd monitor interval set to 10000ms

On another container that has redis in ARG PHP_EXTENSIONS i get this error everytime i do something in console with php:

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

Context

Im trying to enable redis support in the image. If i turn off redis PHP_EXTENSION_REDIS: 0 i wont get any errors, but if I turn it on, it will either crash on start or if it runs, php will give error when trying to use redis for connection. Similar problem discussed here #200 but i didn’t find any solution.

Your Environment

  • Version used: thecodingmachine/php:7.4-v3-slim-fpm
  • Operating System and version: Native Linux Ubuntu 20.04 and aslo Windows 2004 with WSL2 Ubuntu 20.04 and Docker for windows

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I came across the same issue and got to the solution… If you use a slim image you have to enable igbinary alongside with the redis one, as they are enabled by default in fat images only: https://github.com/thecodingmachine/docker-images-php#fat-image

So in case of @beejaz that would be:

version: ‘3.1’

services: php: build: context: ./php args: - PHP_ROOT_DIR=/usr/local/etc environment: TEMPLATE_PHP_INI: development PHP_EXTENSION_GETTEXT: 1 PHP_EXTENSION_PDO: 1 PHP_EXTENSION_PDO_MYSQL: 1 PHP_EXTENSION_LDAP: 1 PHP_EXTENSION_INTL: 1 PHP_EXTENSION_IGBINARY: 1 PHP_EXTENSION_REDIS: 1 volumes: - ./project:/var/www/html - ./logs/php:/usr/local/etc/logs - ./logs/php:/usr/local/var/log

And in case of @robjuz

ARG PHP_EXTENSIONS=“bcmath pdo_sqlite igbinary redis” FROM thecodingmachine/php:8.0-v4-slim-apache

ENV APACHE_DOCUMENT_ROOT=public/
APACHE_RUN_USER=www-data
APACHE_RUN_GROUP=www-data …

I hope this will help you.