RUN pecl install imagickでインストールできないからソースからインストール



先日までpecl install imagickができていたのに出来なくなって
昔とった杵柄(phpize configure make make install)で頑張ってみた

## 駄目だったパターン

Dockerfile
```Dockerfile
FROM php:8-apache-bullseye
〜〜
RUN apt install -y imagemagick libmagickwand-dev
RUN pecl install imagick
```
```
#17 15.94 PHP-Parser-5.0.0alpha3/lib/PhpParser/PrettyPrinterAbstract.php
#17 15.94 PHP-Parser-5.0.0alpha3/lib/PhpParser/Token.php
#17 15.94 PHP-Parser-5.0.0alpha3/lib/PhpParser/compatibility_tokens.php
#17 15.94 PHP-Parser-5.0.0alpha3/phpstan-baseline.neon
#17 15.94 PHP-Parser-5.0.0alpha3/phpstan.neon.dist
#17 15.96 Saved /tmp/pear/temp/imagick/ImagickDraw_arginfo.h
#17 15.97 Parse /tmp/pear/temp/imagick/ImagickPixelIterator.stub.php to generate /tmp/pear/temp/imagick/ImagickPixelIterator_arginfo.h
#17 16.01 Saved /tmp/pear/temp/imagick/ImagickPixelIterator_arginfo.h
#17 16.02 Parse /tmp/pear/temp/imagick/ImagickPixel.stub.php to generate /tmp/pear/temp/imagick/ImagickPixel_arginfo.h
#17 16.06 Saved /tmp/pear/temp/imagick/ImagickPixel_arginfo.h
#17 16.07 Parse /tmp/pear/temp/imagick/Imagick.stub.php to generate /tmp/pear/temp/imagick/Imagick_arginfo.h
#17 16.13 In /tmp/pear/temp/imagick/Imagick.stub.php:
#17 16.13 Unterminated preprocessor conditions
#17 16.13 make: *** [Makefile:196: /tmp/pear/temp/imagick/Imagick_arginfo.h] Error 1
#17 16.14 ERROR: `make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuserpvAjoH/install-imagick-3.7.0" install' failed
```
Imagick_arginfo.h Error 1がなんだかさっぱりわからない。
グーグル検さく検定１級の俺でも見つけられなかった・・

ので、諦めてソースからインストール


## 頑張ったパターン
```Dockerfile
RUN apt install -y imagemagick libmagickwand-dev
#RUN pecl install imagick
RUN apt install -y wget
RUN wget https://pecl.php.net/get/imagick-3.7.0.tgz && \
    tar xzvf imagick-3.7.0.tgz && cd imagick-3.7.0 && \
    phpize && ./configure && \
    make && make install && \
    docker-php-ext-enable imagick
```



```
 => [7/7] RUN wget https://pecl.php.net/get/imagick-3.7.0.tgz &&     tar xzvf imagick-3.7.0.tgz && cd imagick-3.7.0 &&     phpize && ./configure &&     make && make install &&  docker-php-ext-enable imagick    12.3s
 => exporting to image  
```

エラーなくインストールできた

```
$ php -i


PHP Version => 8.3.0

imagick

imagick module => enabled
imagick module version => 3.7.0
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
ImageMagick copyright => (C) 1999-2021 ImageMagick Studio LLC
ImageMagick release date => 2021-01-25
ImageMagick number of supported formats:  => 247
ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, D
ATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP
4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABE
L, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, 
PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF,
 RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, 
UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.allow_zero_dimension_images => 0 => 0
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.set_single_thread => 1 => 1
imagick.shutdown_sleep_count => 10 => 10
imagick.skip_version_check => 0 => 0

```