GraphicsMagick and gmagick PHP module on Shared hosting

GraphicsMagick provides a comprehensive collection of utilities, programming interfaces, and GUIs, to support file format conversion, image processing, and 2D vector rendering. View more information at the following link:

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 GraphicsMagick

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

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

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

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

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

Building the gmagick 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 1.1.7RC3.
    [server]$ wget ""
    [server]$ tar zxvf gmagick-1.1.7RC3.tgz
    [server]$ cd gmagick-1.1.7RC3
  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]$ ./configure --prefix=$HOME/local --with-gmagick=$HOME/local --with-php-config=/usr/local/php56/bin/php-config
    [server]$ make

    You may see a few compilation warnings. You can safely ignore these. Look for the following which ensures successful installation:

    Libraries have been installed in: 
      /home/<your login>/build/gmagick-1.1.7RC3/modules

Configuring PHP to use this extension

Visit the PHP.ini article for details on how to create a phprc file.

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/gmagick-1.1.7RC3/modules/ extensions
[server]$ echo "extension = $HOME/.php/5.6/extensions/" >> phprc

See also

Did this article answer your questions?

Article last updated .