Skip to content

Instantly share code, notes, and snippets.

@sshymko
Last active December 9, 2023 17:40
Show Gist options
  • Save sshymko/c8cff0f8bc51ecdbc4b69554f562526a to your computer and use it in GitHub Desktop.
Save sshymko/c8cff0f8bc51ecdbc4b69554f562526a to your computer and use it in GitHub Desktop.
Install latest ImageMagick 7.x and imagick PHP extension from PECL on Amazon Linux 2
#!/bin/sh
# Uninstall ImageMagic library and imagick PHP extension using it (installed previously)
yum remove -y php-pecl-imagick ImageMagick
# Install libraries for JPG, PNG, GIF, WebP, and TIFF image formats
yum install -y libpng-devel libjpeg-devel openjpeg2-devel libtiff-devel libwebp-devel giflib-devel
# Install latest ImageMagick library compiled from downloaded sources
yum install -y gcc
curl -OL https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzf ImageMagick.tar.gz
cd ImageMagick*
./configure --prefix=/ \
--with-bzlib=yes \
--with-fontconfig=yes --with-freetype=yes \
--with-gslib=yes --with-gvc=yes \
--with-jpeg=yes --with-openjp2=yes \
--with-png=yes \
--with-tiff=yes
make && make install
# Install imagick PHP extension from PECL
yum install -y php-pear php-devel
yes | pecl install imagick
echo 'extension=imagick.so' > /etc/php.d/40-imagick.ini
# Output installed versions
convert --version
php --ri imagick
@jetpen
Copy link

jetpen commented Dec 23, 2022

make is failing with:

CXXLD    utilities/magick
libtool:   error: unsupported hardcode properties See the libtool documentation for more information. Fatal configuration error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment