How to install ImageMagick PHP Extension for EA-PHP and ALT-PHP?

Images play a tactic role in content understanding. One image gives a surplus idea about the content behind. While adding an image on the website or for some other purpose we need to covert, display, and vector accordingly. For this purpose, we need software called “ImageMagick”.

ImageMagick gives an open advantage to PHP whereas just by installing PHP extension; ImageMagick you can access it without norms.

Moreover, installing the ImageMagick PHP extension is not a big task! Follow the below steps to install it in your cPanel server.

Step 1: You have the same running command for ALT-PHP and EA-PHP. So run the below-recommended command via terminal or SSH:

yum install ImageMagick ImageMagick-devel -y
Note: Whenever you install the software, you must be the root user. Don’t forget to login as the root user.

Step 2: Here, we give you two processes for installing ImageMagick in EA-PHP and ALT-PHP.

  • First, you need to find out the PECL binaries for all PHP versions. So, use the below command to find out the binaries:
find /opt/cpanel/ -iname pecl | grep bin
  • Secondly, for all EA-PHP versions, you need to run command separately:
/opt/cpanel/ea-php70/root/usr/bin/pecl install imagick
Your installation over here!


  • Firstly, install CageFS with the help of the below command. Again, you should be the root user to run the command via SSH:
 yum install cagefs
/usr/sbin/cagefsctl --init
/usr/sbin/cagefsctl --enable-all
  • If you installed already then recheck it using the below commands:
/usr/sbin/cagefsctl --enable username
Note: Instead of the word username, replace it with the cPanel username. Execute the command!
  • Now, its time to install ALT-PHP:
yum groupinstall alt-php
yum update cagefs lvemanager
  • You might now install with ALT-PHP. What about versions of ALT-PHP?
/usr/bin/selectorctl --summary
/usr/bin/selectorctl --set-user-current=5.1 --user=username
The above command will specialize in your versions in ALT-PHP. So, version 5. 1 is available with ImageMagick.

Coming to the step 3:

Step 3: In step 3, you need to bring new form of PHP-info document. Once if you create it then recheck with extension of ImageMagick

echo "<?php phpinfo();" > /home/cpaneluser/public_html/phpinfo.php
chown cpaneluser:cpaneluser /home/cptest/public_html/phpinfo.php
chmod 0644 /home/username/public_html/phpinfo.php
lynx --dump | grep -i "imagick module"
Again, replace username word with your cPanel username.

Step 4: Here, we need to confirm the performance of plugin ImageMagick and PHP file:

$image = new Imagick();
$image->newImage(1, 1, new ImagickPixel('#ffffff'));
$pngData = $image->getImagesBlob();
echo strpos($pngData, "\x89PNG\r\n\x1a\n") === 0 ? 'Ok' : 'Failed';
echo "\n";
I Hope, you will have a clear mindset on installing ImageMagick right now! It will be well executed with the team of expertise in system administration.
First release
Last update
0.00 star(s) 0 ratings