0

I am trying to install image magik inside laradock https://github.com/laradock/laradock

I have setup nginx , mysql, redis and elasticsearch. I have tried installing the image magik inside php-fpm with

RUN apt-get -y update && \ apt-get install pkg-config libmagickwand-dev -y && \ pecl install imagick

RUN docker-php-ext-enable imagick

But still image are not generated.

Sandhu
  • 348
  • 5
  • 23

4 Answers4

1

I got it to working by adding following into the docker file of php-fpm for docker image of https://github.com/laradock/laradock

RUN apt-get update && apt-get install -y 
git libmagick++-dev 
--no-install-recommends && 
git clone https://github.com/mkoppanen/imagick.git && 
cd imagick && git checkout phpseven && phpize && ./configure && 
make && make install && 
docker-php-ext-enable imagick && 
cd ../ && rm -rf imagick

Also set PHP_FPM_INSTALL_EXIF=true in the .env next to docker-compose.yml

Remove the previous containers and images and create new build

Sandhu
  • 348
  • 5
  • 23
1

In the .env file there is a variable for installing ImageMagick (In Laradock v7.x ) It's false by default but setting it to PHP_FPM_INSTALL_IMAGEMAGICK=true should do it.

ZR87
  • 1,463
  • 16
  • 27
0

Please try to rebuild the docker containers via the following command.

docker-compose build --no-cache
KaungThant
  • 21
  • 2
0

in .env file turn WORKSPACE_INSTALL_IMAGEMAGICK to true and in workspace's Dockerfile add apt-get update &&\ on IMAGEMAGICK section like this:

    ###########################################################################
# ImageMagick:
###########################################################################

USER root

ARG INSTALL_IMAGEMAGICK=false
ARG IMAGEMAGICK_VERSION=latest
ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}

RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
    apt-get update && \
    apt-get install -y libmagickwand-dev imagemagick && \
    if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
      apt-get install -y git && \
      cd /tmp && \
      if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then \
        git clone https://github.com/Imagick/imagick; \
      else \
        git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick; \
      fi && \
      cd imagick && \
      phpize && \
      ./configure && \
      make && \
      make install && \
      rm -r /tmp/imagick; \
    else \
      pecl install imagick; \
    fi && \
    echo "extension=imagick.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/imagick.ini && \
    ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/imagick.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-imagick.ini && \
    php -m | grep -q 'imagick' \
;fi