-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to install imagick #105
Comments
http://stackoverflow.com/q/14332539/433558 appears to be a report of this exact issue, and the solution in http://stackoverflow.com/a/14354912/433558 is working for me (ie, using FROM php:5
RUN apt-get update && apt-get install -y libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN pecl install imagick-beta |
That seems to solve it. Thanks! |
Somehow the extension is not loaded though. only if I do it this way:
I've added imagick.so to the php.ini file, but that didn't seem to work. Does docker-php-ext-install do something extra besides creating a .ini file? |
Yes, that would be Lines 44 to 57 in ae130b2
So, you probably just need to add something like this: RUN echo 'extension=rmagick.so' > /usr/local/etc/php/conf.d/ext-rmagick.ini I've contemplated adding a |
👍 |
I had troubles getting this to work. In the end I found the following snipplet used by a Wordpress Dockerfile that did work. RUN apt-get update && apt-get install -y libmagickwand-6.q16-dev --no-install-recommends \
&& ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin \
&& pecl install imagick \
&& echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini If this could be abstracted away into am |
It's worth pointing out here that #122 did add FROM php:5
RUN apt-get update && apt-get install -y libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN pecl install imagick && docker-php-ext-enable imagick root@f1a53d21c435:/# php -i | grep magic
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-imagick.ini
libmagic => 517
imagick
imagick module => enabled
imagick module version => 3.3.0
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 6.8.9-9 Q16 x86_64 2015-01-05 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.8.9-9 Q16 x86_64 2015-01-05 http://www.imagemagick.org
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0 |
Is installing 7.0.0
7.0.3
|
@AustinMaddox, that looks like an issue with imagick itself; they don't yet support php7 in their releases, but there is a branch in their code that would work, but I am not sure how stable it is since it is not yet in a regular release. The branch is here https://github.com/mkoppanen/imagick/tree/phpseven and it looks like there is info on installing it in Imagick/imagick#129. There is an RC6 release. |
There's a 3.4.1 release of imagick now which seems to work fine with PHP7. I was able to install it with
|
I'm trying this on Alpine Linux and it doesn't work 😢
Have you a solution for Alpine Linux ? |
@fgirardey, did you also $ apk add --no-cache autoconf gcc g++ imagemagick-dev libtool make To save final image space, you should also be able to remove most of them in the same |
@yosifkit it absolutely solved my problem 😊 my finale image is like that :
|
@fgirardey You want to run |
@franz-josef-kaiser Oh yeah you are right, it wasn't working. Now it seems to be better, thanks a lot :
|
I use this way to install
|
@AliMD, I am hesitant to recommend that way, since the |
I would highly recommend against using Debian-packaged PHP bits with this image -- we don't provide the bits I've just tested the following for installing FROM php:5.6-apache
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libmagickwand-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pecl install imagick-3.4.1 \
&& docker-php-ext-enable imagick And again, with Alpine and PHP 7, for good measure: FROM php:7-alpine
RUN set -x \
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS imagemagick-dev libtool \
&& pecl install imagick-3.4.1 \
&& docker-php-ext-enable imagick \
&& apk add --no-cache --virtual .imagick-runtime-deps imagemagick \
&& apk del .phpize-deps |
Closing, given that the original issue appears to be fully resolved. |
ProTip: Remember to export PHP's CFLAGS/CPPFLAGS/LDFLAGS before installing imagick-3.4.1
Otherwise improved ASLR and optimizations are not taken in count by the extension and therefore makes hardened PHP less safer than it should be. |
@pwnsdx Better press |
@franz-josef-kaiser Noted :) |
For PHP 7.1 you need https://bugs.php.net/bug.php?id=72311 FROM php:7.1-fpm-alpine
RUN set -ex \
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS imagemagick-dev libtool \
&& export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
&& pecl install imagick-3.4.3 \
&& docker-php-ext-enable imagick \
&& apk add --no-cache --virtual .imagick-runtime-deps imagemagick \
&& apk del .phpize-deps |
Same as above comment (PHP 7.1 you need imagick-3.4.3) but for debian based FROM php:7.1-fpm
RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libmagickwand-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pecl install imagick-3.4.3 \
&& docker-php-ext-enable imagick 🚀 |
Its works for me too ... on php 7.2
|
Can confirm @heygrady solution worked for me on |
Solvedalpine3.8 php 7.0 7.1 tested |
Has anyone experience with php:7.2-apache I tried the following RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" It seems that it was installed: php -i | grep imagick But when I type "which convert" e.g nothing returns. |
If you want the |
I ran into some problems trying to install Imagick to a CircleCI container. Specifically, a cryptic The solution was to ignore the error with In total, installation looks like this: sudo apt-get update
sudo apt-get install -y libmagickwand-dev --no-install-recommends
yes '' | sudo pecl install imagick || true
sudo docker-php-ext-enable imagick |
This solution works like a charm for PHP5. RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libmagickwand-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pecl install imagick-3.3.0 \
&& docker-php-ext-enable imagick However, the image build fails when I try to target a specific Imagick beta version (3.2.0RC1, I am trying to reproduce as faithfully as possible our production environment). It would seem like the MagickWand is not compatible (?): checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
ERROR: /tmp/pear/temp/imagick/configure --with-php-config=/usr/local/bin/php-config --with-imagick' failed
The command '/bin/sh -c export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" && apt-get update && apt-get install -y --no-install-recommends libmagickwand-6.q16-dev && rm -rf /var/lib/apt/lists/* && pecl install imagick-3.2.0RC1 && docker-php-ext-enable imagick' returned a non-zero code: 1 |
Best solution php 7.3 |
Just a side note: I recently added Alpine support to my ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions imagick |
Putting all together, even avoiding the interactive shell of "autodetect" : FROM php:7.2-fpm
RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
libmagickwand-dev \
&& rm -rf /var/lib/apt/lists/* \
&& yes '' | pecl install imagick-3.4.3|| true \
&& docker-php-ext-enable imagick But still it does not work. May be my case is different : I have supervisord is the main process (PID 1) and there is no php-fpm is runnning... because the role of this container is to be queue worker only (php artisan queue:work ). UPDATE : wget https://github.com/luvvien/resources/raw/master/ghostscript-9.22-linux-x86_64.tar.gz \
&& tar -xzvf ghostscript-9.22-linux-x86_64.tar.gz \
&& cd ghostscript-9.22-linux-x86_64 \
&& cp gs-922-linux-x86_64 /usr/local/bin/gs \
&& ln -s /usr/local/bin/gs /usr/bin/gs \
&& rm ../ghostscript-9.22-linux-x86_64.tar.gz \
&& rm -rf ghostscript-9.22-linux-x86_64 |
@abdennour did you try |
No @mlocati ! what's this ? |
@abdennour see the above comment #105 (comment) |
@abdennour He was referring to this script here: Edit: I missed the link that @mlocati posted to his extension installer above. He was referring to that one. |
Add mme to this thread, I am getting:
With the following: FROM php:7-apache
RUN apt-get update; \
apt-get install -y autoconf g++ make openssl libmcrypt-dev libreadline-dev libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev zlibc zlib*-dev gi$
docker-php-ext-install gd; \
docker-php-ext-install mysqli; \
docker-php-ext-install pdo; \
docker-php-ext-install pdo_mysql; \
docker-php-ext-install exif; \
pecl channel-update pecl.php.net; \
RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libmagickwand-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pecl install imagick-3.4.3 \
&& docker-php-ext-enable imagick Note, I tried the UPDATE: Switching from |
@AddoSolutions what about using my Here's how you can install the extensions you need: FROM php:7-apache
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions gd mysqli pdo pdo_mysql exif imagick |
@mlocati I did try that for the issue I described, however it still would not work on the latest I am guessing this is an issue with the PHP image, but don't have enough info to prove it, and ran out of time to diagnose :) Going forward however, I will be refactoring the docker image to use that extension is is supremely helpful! Thanks for putting that together 👍 |
@AddoSolutions is your problem with docker hub? If so, see also mlocati/docker-php-extension-installer#378 |
@mlocati Nope, this was a local build from a Dockerfile |
@AddoSolutions what about your local machine: OS? Version? |
|
@AddoSolutions accordingly to this message the reason may be because you are using a rather old linux kernel version EDIT The root cause is that the coreutils that comes with Debian 11 (Bullseye) is version 8.32, and that version prevent docker images from running when the host OS uses a rather old kernel. The solution is to keep using Debian 10 (Buster), which uses coreutils 8.30 (which is not affected by this problem). |
@mlocati I appreciate all the help – I guess it's going to be a day of kernel updates, woohoo! |
@AddoSolutions please keep me updated, I'm really curious to see if that works 😉 |
I'm unable to install imagick. I'm always running into this error:
I've tried all solutions I could find on google, but without any success. Hope to have some luck here. These are the steps I've taken:
The text was updated successfully, but these errors were encountered: