Installing ImageMagick and imagick PHP module on Shared hosting

This article only explains how to install a newer version of ImageMagick and the PHP module. It does not explain how to use it.

ImageMagick is a free software suite used to convert and edit images and is installed by default on all DreamHost servers. To view the current version, log in to your server via SSH and then run the following command:

[server]$ dpkg -l | grep magick

For further details on this software, visit the following site:

Please visit the following article for instructions on using DreamHost's pre-installed ImageMagick with MediaWiki One-Click Installs on DreamHost:

Preparing the environment

  1. Log into your server via SSH.
  2. Make sure you're in your user's main directory, not your domain's directory.
  3. Create a "build" directory where all the required tools are downloaded, configured, and then compiled:
    [server]$ mkdir build
  4. Create a "local" directory where all the required tools are deployed:
    [server]$ mkdir local

Installing ImageMagick

Once you have created the /build and /local directories, proceed with the following commands. This example uses version 6.0.2-0.

[server]$ cd build
[server]$ wget ""
[server]$ tar zxvf ImageMagick-6.9.2-0.tar.gz
[server]$ cd ImageMagick-6.9.2-0
[server]$ ./configure --prefix=$HOME/local --enable-shared --enable-symbol-prefix
[server]$ make
[server]$ make install

If everything runs smoothly, up-to-date ImageMagick binaries, libs collection, documentation and so on are available in your "local" directory (and sub-directory).

Start using this "local" directory by running the following command:

[server]$ export PATH=$HOME/local/bin:$PATH

Building the Imagick PHP module

  1. Navigate to your /build directory.
    [server]$ cd $HOME/build
  2. Visit and choose the version you wish to use.
  3. Run the following commands based on the version you're using. This example uses 3.3.0RC2.
    [server]$ wget ""
    [server]$ tar zxvf imagick-3.3.0RC2.tgz
    [server]$ cd imagick-3.3.0RC2
  4. Run the following to ensure that imagick compiles more smoothly:
    [server]$ /usr/local/php56/bin/phpize
    [server]$ export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig
    [server]$ ln -s $HOME/local/include/ImageMagick-6 $HOME/local/include/ImageMagick
    [server]$ ./configure --prefix=$HOME/local --with-imagick=$HOME/local --with-php-config=/usr/local/php56/bin/php-config
    [server]$ make

    You may see a few compilation warnings, and you can safely ignore these; but, look for the following which ensures successful installation:

    Libraries have been installed in:

Configuring PHP to use this extension

Visit the following article for details on how to create a phprc file via SSH.

In this example the domain is running under PHP 5.6. So your phprc file would be in this directory:


Run the following to create your /extensions directory, copy the module and add it to the phprc file:

[server]$ cd $HOME/.php/5.6
[server]$ mkdir extensions
[server]$ cp $HOME/build/imagick-3.3.0RC2/modules/ extensions
[server]$ echo "extension = $HOME/.php/5.6/extensions/" >> phprc

See also

Did this article answer your questions?

Article last updated PST.