Skip to content

Unable to load dynamic library 'imagick' and 'zip' in Bookworm based php8.2 and php8.1 images #833

Closed

Description

@kpurrucker

The command "php -v" inside the current container with the TAG '6.2.2-php8.2-apache' show me, that the library imagick and zip is broken. This is since the Image based on Bookworm. The Image with the same TAG based on Bullseye has no issue.

The Hash from the latest Container is: sha256:95d9d66652be2ded944716537bcdc223d1f600444a34d0a970d6150d0d7ef9ea

Output:

root@3da134196095:/var/www/html# php -v
[15-Jun-2023 07:32:08 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imagick (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/imagick: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imagick.so (libMagickWand-6.Q16.so.6: cannot open shared object file: No such file or directory)) in Unknown on line 0
[15-Jun-2023 07:32:08 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so (libzip.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.2.7 (cli) (built: Jun 14 2023 05:12:47) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies

Activity

  1. AntonLindell commented on Jun 15, 2023

    @AntonLindell

    I have similar issues when running my ci cd workflow in gitlab. Everything works on local machine though.

    [15-Jun-2023 14:06:09 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so (libMagickWand-6.Q16.so.6: cannot open shared object file: No such file or directory)) in Unknown on line 0
    [15-Jun-2023 14:06:09 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/zip.so (libzip.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20210902/zip.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    Installing dependencies from lock file
    Verifying lock file contents can be installed on current platform.
    Package operations: 60 installs, 0 updates, 0 removals

  2. kpurrucker commented on Jun 15, 2023

    @kpurrucker
    Author

    @AntonLindell Is it possible, you have on the one hand an old Image and on the other a new one? The Tag from the image is still the same, but since Yesterday the Image based on Bookworm. Older images are based on Bullseye.
    In my case the Issues are in the Bookworm Images. If I take the old Bullseye image image with the same TAG everything is fine.

  3. yosifkit commented on Jun 15, 2023

    @yosifkit
    Member

    I'd suggest updating docker and libseccomp on the host. Newer base OS's use newer system calls and an older libseccomp can block them since they are unknown to it. You can verify that it is libseccomp by running the bookworm image with --security-opt seccomp=unconfined.

    I am unable to reproduce any errors:

    $ docker run -it --rm wordpress php -v
    Unable to find image 'wordpress:latest' locally
    latest: Pulling from library/wordpress
    759700526b78: Pull complete
    014a8e7424b0: Pull complete
    dbf764694663: Pull complete
    f50c4f9b9271: Pull complete
    aded95647031: Pull complete
    4ab82896a769: Pull complete
    86ad5aec4044: Pull complete
    d924242ab77a: Pull complete
    8de92f91d55d: Pull complete
    c56c7ab9fd5e: Pull complete
    1ac35c817f6f: Pull complete
    3dace69946e9: Pull complete
    24f140002e8f: Pull complete
    ef290f9cd784: Pull complete
    935fab32d83a: Pull complete
    7625ccd43d46: Pull complete
    7a5cbfb96a96: Pull complete
    110143283a89: Pull complete
    c9f0cdd0ef71: Pull complete
    a5a2ebf19ce9: Pull complete
    151f92ba42ab: Pull complete
    Digest: sha256:b2b0ca82d0193dacbf9a68aae079b3e9b23f9ea298107d553aa469e258a929ad
    Status: Downloaded newer image for wordpress:latest
    PHP 8.0.29 (cli) (built: Jun 14 2023 06:26:00) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v4.0.29, Copyright (c) Zend Technologies
        with Zend OPcache v8.0.29, Copyright (c), by Zend Technologies
    $ docker run -it --rm wordpress cat /etc/os-release
    PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
    NAME="Debian GNU/Linux"
    VERSION_ID="11"
    VERSION="11 (bullseye)"
    VERSION_CODENAME=bullseye
    ID=debian
    HOME_URL="https://www.debian.org/"
    SUPPORT_URL="https://www.debian.org/support"
    BUG_REPORT_URL="https://bugs.debian.org/"
  4. AntonLindell commented on Jun 16, 2023

    @AntonLindell

    @AntonLindell Is it possible, you have on the one hand an old Image and on the other a new one? The Tag from the image is still the same, but since Yesterday the Image based on Bookworm. Older images are based on Bullseye. In my case the Issues are in the Bookworm Images. If I take the old Bullseye image image with the same TAG everything is fine.

    You saved the day! Adding bullseye like:

    FROM php:8.1-apache-bullseye

    in the Dockerfile from this repo made my Gitlab job succeed, finally.

  5. kpurrucker commented on Jun 16, 2023

    @kpurrucker
    Author

    @yosifkit

    I'd suggest updating docker and libseccomp on the host. Newer base OS's use newer system calls and an older libseccomp can block them since they are unknown to it. You can verify that it is libseccomp by running the bookworm image with --security-opt seccomp=unconfined.

    I try it again with the lates Image from today on an fresh installed Debian Bookworm and with the latest Docker from https://download.docker.com/linux/debian bookworm stable and no Issue.

    With the same Setup and with the latest Image with the TAG wordpress:6.2.2-php8.2-apache I have warnings from PHP:

    [16-Jun-2023 07:33:04 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imagick (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/imagick: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/imagick.so (libMagickWand-6.Q16.so.6: cannot open shared object file: No such file or directory)) in Unknown on line 0
    [16-Jun-2023 07:33:04 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so (libzip.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    PHP 8.2.7 (cli) (built: Jun 14 2023 05:12:47) (NTS)
    Copyright (c) The PHP Group
    Zend Engine v4.2.7, Copyright (c) Zend Technologies
        with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies
    

    Both Images comes with Bookworm, Apache 2.4.56-1~deb11u2, but the Digest and the PHP Version from the image with the TAG 'latest' and the TAG 'wordpress:6.2.2-php8.2-apache' are different.

    root@bert ~ # docker pull wordpress:6.2.2-php8.2-apache
    6.2.2-php8.2-apache: Pulling from library/wordpress
    Digest: sha256:bf91b4919c4da70e1f06c1adf62262bc06f064e891d7735c6d52afc147b3b71d
    Status: Image is up to date for wordpress:6.2.2-php8.2-apache
    docker.io/library/wordpress:6.2.2-php8.2-apache
    
    root@bert ~ # docker pull wordpress:latest
    latest: Pulling from library/wordpress
    Digest: sha256:fe04981c522144c731db6db165b896dd890280fdd915df8b5b0505d9ce2878cf
    Status: Image is up to date for wordpress:latest
    docker.io/library/wordpress:latest
    

    So it seems a Bug in the latest and Debian Bookworm based images with PHP 8.2 and not with image with the TAG 'latest'. I will edit the initial post and concretize it.

  6. changed the title [-]Unable to load dynamic library 'imagick' and 'zip'[/-] [+]Unable to load dynamic library 'imagick' and 'zip' in Bookworm based php8.2 images[/+] on Jun 16, 2023
  7. justlevine commented on Jun 16, 2023

    @justlevine

    Doesnt seem this is just limited to PHP 8.2. As of yesterday, my CI has been throwing the same error for wordpress:6.2-php8.1-apacheas well.

  8. kpurrucker commented on Jun 16, 2023

    @kpurrucker
    Author

    @justlevine I can reproduce this issue also with the PHP 8.1 Image and will edit the Title.

  9. changed the title [-]Unable to load dynamic library 'imagick' and 'zip' in Bookworm based php8.2 images[/-] [+]Unable to load dynamic library 'imagick' and 'zip' in Bookworm based php8.2 and php8.1 images[/+] on Jun 16, 2023
  10. kpurrucker commented on Jun 20, 2023

    @kpurrucker
    Author

    @5t111111 That's work, but is a little bit tricky. The TAG doesn't include the Debian Release an are the same. It's work, if I use a old Container ID:

    docker pull wordpress@sha256:fe2a0a24616610bd5644a4487dae1dc5b1d9c033eec83d3314514e1079a0f8fa
    

    But this old container has only PHP Version 8.2.6 and not the new 8.2.7.

  11. tianon commented on Jun 20, 2023

    @tianon
    Member

    Oh, I found the issue! It is bookworm related, but not the normal seccomp failure 😅

    Fix is up at #834 👍

  12. added a commit that references this issue on Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions