DEV Community

Cover image for Problem with Installing ImageMagick for PHP 8.4 in Docker.
Lukas Hron
Lukas Hron

Posted on

Problem with Installing ImageMagick for PHP 8.4 in Docker.

If you use the ImageMagick extension and plan to upgrade to PHP 8.3 or 8.4, you will encounter an issue with installation via PECL. Unfortunately, the PECL package is not compatible with these PHP versions, causing the installation to fail. As an alternative, you can build the source code directly from the repository, which allows you to bypass this issue and successfully configure ImageMagick.

RUN apt-get update && apt-get install -y \
    imagemagick \
    libmagickwand-dev \
    && git clone https://github.com/Imagick/imagick --depth 1 /tmp/imagick \
    && cd /tmp/imagick \
    && phpize && ./configure \
    && make \
    && make install \
    && apt-get clean

RUN docker-php-ext-enable imagick
Enter fullscreen mode Exit fullscreen mode

Top comments (0)