Imagick / imagick

🌈 The Imagick PHP extension 🌈
http://pecl.php.net/imagick
Other
536 stars 135 forks source link

Adding php-imagick extension to Alpine Docker container fails #683

Open 4d4ch4u32 opened 1 month ago

4d4ch4u32 commented 1 month ago

I try to add the imagick php extension to my Docker container:

FROM php:8.3-fpm-alpine AS base

RUN apk add --update --no-cache --virtual .build-deps $PHPIZE_DEPS imagemagick imagemagick-dev \
    && pecl install imagick \
    && docker-php-ext-enable imagick \
    &&  rm -rf /tmp/pear \
    && apk del .build-deps

The process fails with the following error:

14.37 PHP-Parser-5.0.0/phpstan.neon.dist
14.38 Saved /tmp/pear/temp/imagick/ImagickPixel_arginfo.h
14.38 Parse /tmp/pear/temp/imagick/Imagick.stub.php to generate /tmp/pear/temp/imagick/Imagick_arginfo.h
14.41 In /tmp/pear/temp/imagick/Imagick.stub.php:
14.41 Unterminated preprocessor conditions
14.41 make: *** [Makefile:196: /tmp/pear/temp/imagick/Imagick_arginfo.h] Error 1
14.41 ERROR: `make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuserAclDeF/install-imagick-3.7.0" install' failed
------
failed to solve: process "/bin/sh -c apk add --update --no-cache --virtual .build-deps $PHPIZE_DEPS imagemagick imagemagick-dev     && pecl install imagick     && docker-php-ext-enable imagick     &&  rm -rf /tmp/pear     && apk del .build-deps" did not complete successfully: exit code: 1
BS666 commented 1 month ago

Encountering this since php 8.3.10 on CentOs 9 with default install options by pear as well.

jdmaguire commented 1 month ago

See https://github.com/Imagick/imagick/issues/640, known issue.

It seems like master has a fix but no release yet has a fix. Either one needs to wait for a release or build from source.

vknowles-rv commented 1 month ago

Not making light of OSS being hard, but IMO if you can get away with using the gd extension instead I'd go that route.

This extension hasn't seen a healthy amount of development in over a year.

feisar-uk commented 3 days ago

This works for me in PHP 8.3 - 8.3.11

# Install Imagick - works in PHP 8.3
RUN apt-get install -y libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/src/php/ext/imagick
RUN chmod 777 /usr/src/php/ext/imagick
RUN curl -fsSL https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz | tar xvz -C "/usr/src/php/ext/imagick" --strip 1
RUN docker-php-ext-install imagick
RUN rm /etc/ImageMagick-6/policy.xml