How to install PHP imagemagick extension

Share This Post

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.

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

How to Off-load WordPress media on DigitalOcean Spaces

Images and other media files can help make your WordPress site look more stunning and engaging for users. Adding more media files on WordPress results in an unorganized structure of your media library. You might have faced this problem, I think. This makes it difficult for you to find the

How to Set up Self-hosted Web Analytics with Matomo on Cloud

Website analytics is crucial to understanding your audience in terms of how they behave and react, respecting your site. Right? It might be possible that you already use a website analytics tool, primarily Google Analytics. Data becomes more powerful to find new opportunities using data analysis as your business grows.