Note The extension Imagick is now included in Ondrej's PPA. All you need to do now is
$ sudo apt-get install php-imagick
, and you're done. I'll keep the guide here because a lot of it is still true for other extensions
======
I've installed PHP7 via Ondrej's PPA. He maintains these PPA's on his free time, consider donating
$ sudo apt-get install php7.0-dev
$ sudo apt-get install pkg-config
$ sudo apt-get install libmagickwand-dev
$ sudo apt-get install imagemagick
$ sudp apt-get install build-essential
# Or
$ sudo apt-get install -y php7.0-dev pkg-config libmagickwand-dev imagemagick build-essential
Mikko Koppanen have a PHP 7 compatible build of imagick. Be sure to download the phpseven branch (We're doing that below). I suppose you could clone the repo if you want the latest changes available more easily
I usually create a download directory for temporary downloads
mkdir downloads
$ cd downloads
$ wget https://github.com/mkoppanen/imagick/archive/phpseven.zip
Unzip it:
$ unzip phpseven.zip
Cd into it
$ cd imagick-phpseven
Phpize it
$ phpize
Configure it and run make
$ ./configure
$ make
$ sudo make install
Tell PHP about the extension (Modified steps from Fideloper's guide for sphinx)
$ echo "extension=imagick.so" | sudo tee /etc/php/mods-available/imagick.ini
# Symlink it to fpm
$ sudo ln -s /etc/php/mods-available/imagick.ini /etc/php/7.0/fpm/conf.d/20-imagick.ini
# Symlink it to cli
$ sudo ln -s /etc/php/mods-available/imagick.ini /etc/php/7.0/cli/conf.d/20-imagick.ini
# Reload php-fpm
sudo service php7.0-fpm reload