I am trying this:

sudo apt-get install imagemagick libmagickwand-dev
sudo pecl install imagick

And I getting an error at the end like:

/tmp/pear/temp/imagick/imagick_class.c:9534:2: error: 'struct _php_core_globals' has no member named 'safe_mode'
/tmp/pear/temp/imagick/imagick_class.c:9534:2: error: 'CHECKUID_CHECK_FILE_AND_DIR' undeclared (first use in this function)
/tmp/pear/temp/imagick/imagick_class.c:9534:2: error: 'CHECKUID_NO_ERRORS' undeclared (first use in this function)
make: *** [imagick_class.lo] Error 1
ERROR: `make' failed

So my question is what are the requirements for Installing imagick's latest version on ubuntu. And its procedure to install ?

I have: PHP Version 5.4.7
XAMPP for Linux 1.8.1


1 Answer 1


You dont't have to install through PECL or install the MagickWand. Just follow the following steps and everything will work fine.

First of all remove everything what you have tried to make it work. Uninstall ImageMagick by following command,

sudo apt-get remove imagemagick

sudo apt-get remove --auto-remove imagemagick

sudo apt-get purge imagemagick

Well, all your previous installation files are just gone. Now Install it purely and perfectly without any conflict or file modification. Enter the following two commands,

sudo apt-get install imagemagick

sudo apt-get install php5-imagick

That was way too easy - thanks interwebs! Remember to restart/reload your webserver..

sudo service apache2 graceful

That's all. Check your php.ini or test with any simple script. You can find some simple scripts here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .