Local Community

Step by Step - Imagemagick Support for PHP 7+

These instructions were tested on PHP 7.2 which at the time of writing was available in pre-release version 2.2.0

Open a SSH shell on the site.

apt-get update && apt-get install -y pkg-config libmagickwand-dev imagemagick build-essential git autoconf

cd /

git clone --depth 1 https://github.com/mkoppanen/imagick.git

cd imagick

/opt/php/7.2.0/bin/phpize

./configure --with-php-config=/opt/php/7.2.0/bin/php-config

make install

echo -e ‘\n\nextension = /opt/php/7.2.0/lib/php/extensions/no-debug-non-zts-20170718/imagick.so’ >> /conf/php/7.2.0/php.ini

service php-7.2.0-fpm restart

3 Likes

Thanks for the guide.
It all went good 'til after this

when I give ‘cd imagick’ command it says ‘no such file or directory’.

Any help, please?
Thanks.

It works! Thank you very much!

Thanks very much for your guide. I’m not using Local but was on an Ubuntu server (16.04) and needed Imagick and your guide really helped as I had several php versions installed. My set of commands were slightly different and I’ll put them here in case they are of use to anyone else.

After installing Image Magick through the control panel I used the following steps to install php-imagick:

cd /usr/local/apps/
sudo apt-get purge php-imagick // remove previous versions
sudo apt-get update
sudo apt-get install libmagickwand-dev
sudo pecl download imagick
sudo tar -xzvf imagick-3.4.4.tgz
sudo mv imagick-3.4.4 imagick
sudo rm imagick-3.4.4.tgz
cd imagick/
sudo /usr/local/apps/php73/bin/phpize
sudo ./configure --with-php-config=/usr/local/apps/php73/bin/php-config
make
sudo make
make install
sudo make install
sudo echo -e ‘\n\nextension=/usr/local/apps/php73/lib/extensions/no-debug-non-zts-20180731/imagick.so’ >> /usr/local/apps/php73/etc/php.ini
sudo service restart php-fpm73 restart
sudo service restart httpd restart

Thanks again!