# In general you can just run 'pecl install imagick', or maybe this:
# C_INCLUDE_PATH=/usr/local/include/ImageMagick-6 pecl install imagick
# but if that is not good enough for you, see below for the latest source
# release and how to install it from the Git repository.
# I was unable to build 3.4.3 via pecl or released source using ImageMagick 7,
# but was able to build it with the code in Git
# I was able to build 3.4.4 with ImageMagick 6 via
# 'C_INCLUDE_PATH=/usr/local/include/ImageMagick-6 pecl install imagick'
# but got a symbol lookup error.
#
# It did work for me as below using 3.4.4 from source.
# Get it
cd
test -f installed/imagick-3.7.0.tgz &&
mv installed/imagick-3.7.0.tgz .
test ! -f imagick-3.7.0.tgz &&
wget https://pecl.php.net/get/imagick-3.7.0.tgz
# Extract the source
mkdir -p -m 0700 ~/src
cd src
find -maxdepth 1 -type d -name "imagick-*" -exec rm -r {} \;
tar xzvf ~/imagick-3.7.0.tgz
cd imagick-3.7.0
test $UID = 0 && chown -R root:root .
# Make it configurable & buildable
phpize
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --with-imagick=/usr/local --with-libdir=lib64
# Configure the build for anything else:
test $(uname -m) != 'x86_64' &&
./configure --with-imagick=/usr/local
# Build it
make
# Test the build
make test
# Install it
su -c "make install"
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/imagick-*.tgz
mv -f imagick-3.7.0.tgz installed/
# If it's there already, clean it up and update it
test -d ./imagick &&
( cd imagick
make distclean
git fetch )
# If it's not there already, get it via 'git clone'
test ! -d ./imagick &&
git clone https://github.com/mkoppanen/imagick.git
cd imagick
# Make it configurable and buildable
phpize
# Configure the build
test $(uname -m) = 'x86_64' && ./configure --with-libdir=lib64
test $(uname -m) != 'x86_64' && ./configure
# Build it
make
# Test the build
make test
# Install it
su -c "make install"
# This should get you a imagick.so in somewhere like this:
# /usr/local/lib64/extensions/no-debug-non-zts-20170718
# Now start|restart Apache + PHP
# If there are any issues with it, to disable it, comment out the imagick.so
# line in /usr/local/lib64/php.ini - or wherever yours is, it may be in
# /etc/httpd or any number of other places...
#
# If there are issues, you should see something like this in error_log
# PHP Warning: PHP Startup: Unable to load dynamic library
# '/usr/local/lib64/extensions/no-debug-zts-20151012/imagick.so'