imagick error when trying to install php in docker

152 Views Asked by At

i already have PHP, mysql, apache running with no issues

when i tried to update the php version and run docker again, the `imagick` throw error

here is the Dockerfile code

FROM php:8.1.27-apache

RUN apt-get update && apt-get install -y --no-install-recommends \
  autoconf \
  build-essential \
  apt-utils \
  zlib1g-dev \
  libzip-dev \
  unzip \
  zip \
  libmagick++-dev \
  libmagickwand-dev \
  libpq-dev \
  libfreetype6-dev \
  libjpeg62-turbo-dev \
  libpng-dev \
  sendmail


RUN docker-php-ext-install gd intl pdo_mysql pdo_pgsql mysqli zip

RUN pecl install imagick-3.4.3

RUN pecl install xdebug && docker-php-ext-enable xdebug

RUN docker-php-ext-enable imagick

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN echo "sendmail_path=/usr/sbin/sendmail -t -i" >> /usr/local/etc/php/conf.d/sendmail.ini 

RUN sed -i '/#!\/bin\/sh/aservice sendmail restart' /usr/local/bin/docker-php-entrypoint


# Clear package lists
RUN apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Permissions
RUN chown -R root:www-data /var/www/html
RUN chmod u+rwx,g+rx,o+rx /var/www/html
RUN find /var/www/html -type d -exec chmod u+rwx,g+rx,o+rx {} +
RUN find /var/www/html -type f -exec chmod u+rw,g+rw,o+r {} +

WORKDIR /var/www/html

RUN a2enmod rewrite
RUN a2enmod ssl

EXPOSE 80
EXPOSE 443

Here is the complete log, mysql and phpMyAdmin both installed no issues the only issue is when it gets to the imagick library

 => ERROR [WebApp  4/17] RUN pecl install imagick-3.4.3                                                                                                                                                                                                                                              5.9s
------                                                                                                                                                                                                                                                                                                    
 > [WebApp  4/17] RUN pecl install imagick-3.4.3:                                                                                                                                                                                                                                                         
2.082 downloading imagick-3.4.3.tgz ...                                                                                                                                                                                                                                                                   
2.082 Starting to download imagick-3.4.3.tgz (245,410 bytes)                                                                                                                                                                                                                                              
2.082 ...................................................done: 245,410 bytes                                                                                                                                                                                                                              
2.605 19 source files, building                                                                                                                                                                                                                                                                           
2.605 running: phpize
2.616 Configuring for:
2.616 PHP Api Version:         20210902
2.616 Zend Module Api No:      20210902
2.616 Zend Extension Api No:   420210902
3.293 Please provide the prefix of Imagemagick installation [autodetect] : building in /tmp/pear/temp/pear-build-defaultuserb3WudB/imagick-3.4.3
3.293 running: /tmp/pear/temp/imagick/configure --with-php-config=/usr/local/bin/php-config --with-imagick
3.404 checking for grep that handles long lines and -e... /usr/bin/grep
3.406 checking for egrep... /usr/bin/grep -E
3.411 checking for a sed that does not truncate output... /usr/bin/sed
3.425 checking for pkg-config... /usr/bin/pkg-config
3.426 checking pkg-config is at least version 0.9.0... yes
3.427 checking for cc... cc
3.521 checking whether the C compiler works... yes
3.521 checking for C compiler default output file name... a.out
3.565 checking for suffix of executables...
3.615 checking whether we are cross compiling... no
3.635 checking for suffix of object files... o
3.661 checking whether the compiler supports GNU C... yes
3.681 checking whether cc accepts -g... yes
3.784 checking for cc option to enable C11 features... none needed
3.816 checking how to run the C preprocessor... cc -E
3.858 checking for icc... no
3.867 checking for suncc... no
3.868 checking for system library directory... lib
3.915 checking if compiler supports -Wl,-rpath,... yes
4.334 checking build system type... x86_64-pc-linux-gnu
4.334 checking host system type... x86_64-pc-linux-gnu
4.334 checking target system type... x86_64-pc-linux-gnu
4.373 checking for PHP prefix... /usr/local
4.373 checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
4.373 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20210902
4.373 checking for PHP installed headers prefix... /usr/local/include/php
4.396 checking if debug is enabled... no
4.412 checking if zts is enabled... no
4.413 checking for gawk... no
4.413 checking for nawk... nawk
4.416 checking if nawk is broken... no
4.416 checking whether to enable the imagick extension... yes, shared
4.417 checking for pkg-config... /usr/bin/pkg-config
4.417 checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
4.417 checking Testing /usr/bin/MagickWand-config... Doesn't exist
4.417 checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
4.417 checking Testing /opt/bin/MagickWand-config... Doesn't exist
4.417 checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
4.419 found in /usr/bin/pkg-config
4.425 checking if ImageMagick version is at least 6.2.4... found version 6.9.11
4.428 checking for MagickWand.h or magick-wand.h header... /usr/include/ImageMagick-6/wand/MagickWand.h
4.437 checking PHP version is at least 5.1.3... yes. found 8.1.27
4.437 libs
4.437 -lMagickWand-6.Q16 -lMagickCore-6.Q16
4.437 
4.437 
4.576 checking for MagickGetVersion... yes
4.671 checking for MagickSetImageInterpolateMethod... yes
4.690 checking for a sed that does not truncate output... /usr/bin/sed
4.695 checking for ld used by cc... /usr/bin/ld
4.698 checking if the linker (/usr/bin/ld) is GNU ld... yes
4.698 checking for /usr/bin/ld option to reload object files... -r
4.700 checking for BSD-compatible nm... /usr/bin/nm -B
4.700 checking whether ln -s works... yes
4.700 checking how to recognize dependent libraries... pass_all
4.737 checking for stdio.h... yes
4.761 checking for stdlib.h... yes
4.787 checking for string.h... yes
4.812 checking for inttypes.h... yes
4.838 checking for stdint.h... yes
4.863 checking for strings.h... yes
4.890 checking for sys/stat.h... yes
4.914 checking for sys/types.h... yes
4.943 checking for unistd.h... yes
4.972 checking for dlfcn.h... yes
4.977 checking the maximum length of command line arguments... 1572864
5.043 checking command to parse /usr/bin/nm -B output from cc object... ok
5.047 checking for objdir... .libs
5.047 checking for ar... ar
5.047 checking for ranlib... ranlib
5.047 checking for strip... strip
5.120 checking if cc supports -fno-rtti -fno-exceptions... no
5.120 checking for cc option to produce PIC... -fPIC
5.139 checking if cc PIC flag -fPIC works... yes
5.231 checking if cc static flag -static works... yes
5.263 checking if cc supports -c -o file.o... yes
5.276 checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
5.301 checking whether -lc should be explicitly linked in... no
5.316 checking dynamic linker characteristics... GNU/Linux ld.so
5.316 checking how to hardcode library paths into programs... immediate
5.320 checking whether stripping libraries is possible... yes
5.320 checking if libtool supports shared libraries... yes
5.320 checking whether to build shared libraries... yes
5.320 checking whether to build static libraries... no
5.464 
5.464 creating libtool
5.482 appending configuration tag "CXX" to libtool
5.545 configure: patching config.h.in
5.548 configure: creating ./config.status
5.599 config.status: creating config.h
5.631 running: make
5.635 /bin/bash /tmp/pear/temp/pear-build-defaultuserb3WudB/imagick-3.4.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/imagick -I/tmp/pear/temp/pear-build-defaultuserb3WudB/imagick-3.4.3/include -I/tmp/pear/temp/pear-build-defaultuserb3WudB/imagick-3.4.3/main -I/tmp/pear/temp/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/x86_64-linux-gnu/ImageMagick-6 -I/usr/include/ImageMagick-6  -DHAVE_CONFIG_H  -g -O2   -I/usr/include/x86_64-linux-gnu/ImageMagick-6 -I/usr/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16  -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/imagick/imagick_file.c -o imagick_file.lo  -MMD -MF imagick_file.dep -MT imagick_file.lo
5.719 mkdir .libs
5.722  cc -I. -I/tmp/pear/temp/imagick -I/tmp/pear/temp/pear-build-defaultuserb3WudB/imagick-3.4.3/include -I/tmp/pear/temp/pear-build-defaultuserb3WudB/imagick-3.4.3/main -I/tmp/pear/temp/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/x86_64-linux-gnu/ImageMagick-6 -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g -O2 -I/usr/include/x86_64-linux-gnu/ImageMagick-6 -I/usr/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/imagick/imagick_file.c -MMD -MF imagick_file.dep -MT imagick_file.lo  -fPIC -DPIC -o .libs/imagick_file.o
5.873 In file included from /tmp/pear/temp/imagick/imagick_file.c:22:
5.873 /tmp/pear/temp/imagick/php_imagick_file.h:61:108: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.873    61 | zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
5.873       |                                                                                                            ^~~~~~~~~
5.873 /tmp/pear/temp/imagick/php_imagick_file.h:65:54: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.873    65 | int php_imagick_safe_mode_check(const char *filename TSRMLS_DC);
5.873       |                                                      ^~~~~~~~~
5.873 /tmp/pear/temp/imagick/php_imagick_file.h:68:134: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.873    68 | php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC);
5.873       |                                                                                                                                      ^~~~~~~~~
5.873 /tmp/pear/temp/imagick/php_imagick_file.h:71:153: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.873    71 | php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC);
5.873       |                                                                                                                                                         ^~~~~~~~~
5.873 /tmp/pear/temp/imagick/php_imagick_file.h:74:112: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.873    74 | zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC);
5.873       |                                                                                                                ^~~~~~~~~
5.873 /tmp/pear/temp/imagick/imagick_file.c:81:51: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.873    81 | zend_bool php_imagick_is_url(const char *filename TSRMLS_DC)
5.873       |                                                   ^~~~~~~~~
5.873 /tmp/pear/temp/imagick/imagick_file.c:91:108: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874    91 | zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC)
5.874       |                                                                                                            ^~~~~~~~~
5.874 /tmp/pear/temp/imagick/imagick_file.c:160:133: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874   160 | int php_imagick_read_image_using_imagemagick(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
5.874       |                                                                                                                                     ^~~~~~~~~
5.874 /tmp/pear/temp/imagick/imagick_file.c:185:133: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874   185 | int php_imagick_read_image_using_php_streams(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
5.874       |                                                                                                                                     ^~~~~~~~~
5.874 /tmp/pear/temp/imagick/imagick_file.c:239:54: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874   239 | int php_imagick_safe_mode_check(const char *filename TSRMLS_DC)
5.874       |                                                      ^~~~~~~~~
5.874 /tmp/pear/temp/imagick/imagick_file.c:253:134: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874   253 | php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
5.874       |                                                                                                                                      ^~~~~~~~~
5.874 /tmp/pear/temp/imagick/imagick_file.c:272:153: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874   272 | php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC)
5.874       |                                                                                                                                                         ^~~~~~~~~
5.874 /tmp/pear/temp/imagick/imagick_file.c:297:112: error: expected ';', ',' or ')' before 'TSRMLS_DC'
5.874   297 | zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC)
5.874       |                                                                                                                ^~~~~~~~~
5.878 make: *** [Makefile:209: imagick_file.lo] Error 1
5.883 ERROR: `make' failed
------
failed to solve: process "/bin/sh -c pecl install imagick-3.4.3" did not complete successfully: exit code: 1

i tried changing the imagick version but it didn't work

0

There are 0 best solutions below