Update added on 14th november 2017: Adding imagick on a forge provisioned server is now as simple as running sudo apt-get install php-imagick


Today I set up some PHP 7 servers on Forge. Those servers are going to be used to host some Blender based projects. Blender uses laravel-medialibrary to convert images. The package uses Imagick to do that. It turns out the Imagick PHP 7 extension isn't released yet. But there's an RC2 release candidate. Pascal Baljet provided this script to compile and install the extension.

#!/bin/bash
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget http://pecl.php.net/get/imagick-3.4.0RC2.tgz
tar xvzf imagick-3.4.0RC2.tgz
cd imagick-3.4.0RC2
phpize
./configure
make install
rm -rf /tmp/imagick-3.4.0RC2*
echo extension=imagick.so >> /etc/php/7.0/cli/php.ini
service php7.0-fpm restart
service nginx restart

I was a bit worried that the extension would be unstable, but all image manipulations that I need on my projects (cropping and resizing some stuff), just worked. Mandatory disclaimer: your mileage may vary.