Krystal Hosting Blog

How to Install PHP7 with Imagemagick on CloudLinux

By: Tom Mason in Administration

Posted on: January 22nd 2016 at 17:08pm


Firstly we want to get PHP 7 installed and updated to the latest version on your web hosting server. Please note this will also bring all your other PHP versions up to the cutting edge – I’ve not experienced any problems with this, but you could exclude them if you’re worried.

yum groupinstall alt-php—enablerepo=cloudlinux-updates-testing


This will take a few minutes. Once complete we want to grab a version of the ImageMagick module that is compatible with PHP7 – at the moment this is in Beta.

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

We now need to compile the module using the PHP70 binaries, and move them into position:

/opt/alt/php70/usr/bin/phpize
./configure—with-php-config=/opt/alt/php70/usr/bin/php-config
make
cp -rp modules/*.so /opt/alt/php70/usr/lib64/php/modules/

All we need to do now is create this file /opt/alt/php70/etc/php.d.all/imagick.ini and enter the following:

; Enable Image Magick extension module
extension=imagick.so

… and register this with Cloud Linux:

cagefsctl—setup-cl-selector

The module will now appear under PHP 7 under the PHP-Selector.

..and once enabled will show up in your phpinfo: