How to install PHP imagemagick extension

PHP imagemagick extension is used to modify and create images using imagemagick API. Some WordPress plugins or some packages might require you to have PHP imagemagick installed in your configuration.

By default, ServerAvatar does not install imagemagick PHP extension on your servers. To install the module, Just follow this tutorial. It’s very easy and it does not require you to have too much knowledge of Linux or system administration.

First of all, Connect with your server using SSH. If you are using Ubuntu or Mac, Just open up the terminal and type the following command.

ssh root@IP_ADDRESS

Logging in as a root user is not required. However, You need root privileges to install new packages. So, If you are not logging in as a root, Log in with a user having sudo privileges.

Once logged in, Just execute the following commands to install PHP imagemagick extension on your server.

sudo apt-get install make autoconf gcc pkg-config

sudo apt-get install libmagickwand-dev php-imagick

Installation might take few minutes as it will install tens of new packages on which these packages might depend. Once the installation is done, PHP imagemagick is installed on the server.

But it won’t work until we activate the extension in PHP configuration. To enable the PHP imagemagick extension, just execute the following command in the terminal.

sudo phpenmod imagick

You would not get any output of the command but we can verify if the extension is enabled successfully or not. If you don’t get any output, The extension is enabled successfully. To save changes, Restart PHP by using the following command.

sudo service php7.0-fpm restart

To verify the installation of php imagemagick extension, Execute the following command and you can expect output as follows.

php7.0 -i | grep imagick

Output:

imagick
imagick module => enabled
imagick module version => 3.4.0RC6
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0

If you are using a different version of PHP, Just replace 7.0 with the version you are using. For example, If you are using PHP5.6, Execute the command php5.6 -i | grep imagick.

So, this is how you can install PHP imagemagick extension in your configuration. If you are a ServerAvatar user, You can just create a ticket and we will install it for you in case you don’t want to mess with the configuration.

If you are facing any issue following this tutorial, let us know in the comment section, we will help you install the extension in your configuration.

Sharing is caring 🙂
0Shares

Leave a Comment

So glad to see you sticking around!

Interesting in learning New techniques to Improve the performance of your WordPress/PHP website or your Web Server?

Enter your E-mail below and get new techniques that we discover by experimenting new stuff directly to your inbox!

Thank You For Subscribing

This means the world to us!

Spamming is not included! Pinky promise.