15

We are getting this error while installing ImageMagick PECL:

checking ImageMagick MagickWand API configuration program... found in /usr/local/bin/MagickWand-config checking if ImageMagick version is at least 6.2.4... found version 6.8.6 Q16 checking for MagickWand.h header file... configure: error: Cannot locate header file MagickWand.h ERROR: `/root/tmp/pear/imagick/configure --with-imagick' failed extension imagick.so installed in /usr/local/lib/php.ini /usr/local/bin/php does not have a php.ini Tidying /usr/local/cpanel/3rdparty/php/53/etc/php.ini... No changes

Any idea how to fix this ?

capte
  • 207
  • 1
  • 3
  • 9

5 Answers5

22

This thread is old, but I solved this issue today on a Centos 7 by installing ImageMagick-devel package:

yum install ImageMagick-devel

Hope this helps.

e-Jim
  • 321
  • 2
  • 3
19

Steps:

  1. apt-get install libmagickwand-dev
  2. /opt/lampp/bin/pecl install imagick
  3. gedit /opt/lampp/etc/php.ini
  4. add "extension=imagick.so" to php.ini
Fabrizio
  • 7,603
  • 6
  • 44
  • 104
H Arif
  • 431
  • 4
  • 7
4

Probably its looking for the file MagickWand.h and unable to see that file in the defined location. Try these steps

wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxf imagick-3.1.0RC2.tgz

Edit the file imagick-3.1.0RC2/config.m4 line number 55.

Make changes like this, from

if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h;

to

if test -r $WAND_DIR/include/ImageMagick-6/wand/MagickWand.h;

Note this difference made in the imagick version number. After that try the conventional installation procedures

cd imagick-3.1.0RC2
phpize
./configure
make
make install
j0k
  • 22,600
  • 28
  • 79
  • 90
Leo Prince
  • 2,019
  • 26
  • 29
  • 4
    You can easily install the imagick using yum. try "yum install ImageMagick ImageMagick-devel" – Leo Prince Jul 25 '13 at 04:17
  • Hi Leo, I get this error after ./configure : "checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config program." Any idea ? – Pascal Messana Jul 31 '13 at 08:19
  • Are you having this error after the mentioned error "configure: error: Cannot locate header file MagickWand.h". If so did you tried the steps I have given above. – Leo Prince Jul 31 '13 at 20:31
  • Yes, I edited the file config.m4 on line 55 : "if test -r $WAND_DIR/include/ImageMagick-6/wand/MagickWand.h; then". I am on Mac Lion with Mamp. – Pascal Messana Aug 01 '13 at 09:44
  • Here is pretty good way for [Mamp](http://www.imagemagick.org/script/binary-releases.php) Go through the steps and try to finish installation. All the best :) – Leo Prince Aug 01 '13 at 15:37
  • Thanks ! I've followed the guide on Mac OS X and it works, I can see the wizard image ("display logo.gif"). However I can't make it work in MAMP, I have this error in my php error log : "[02-Aug-2013 07:51:11] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so' - dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so, 9): image not found in Unknown on line 0" . Any idea ? – Pascal Messana Aug 02 '13 at 05:54
  • That means imagick.so module is not loading by your php. what is your php version? Put a [phpinfo](http://php.net/manual/en/function.phpinfo.php) in the root directory of your website and check the "Loaded Configuration" and make sure that there is an entry like "extension=imagick.so" in it. Also look for "Extension Directory"(from phpinfo) and check whether imagick.so is placed there. Did you had any sort of issues at the time of installation? – Leo Prince Aug 02 '13 at 06:09
  • There is "extension=imagick.so" in my php.ini but there is no file "imagick.so" in my extension directory (_extension_dir_ in php info). Do I have to download it and paste it here ? I've tried a "locate imagick.so" in my Terminal but nothing found. I did not have any issues during my last installation. Thanks for your help ! – Pascal Messana Aug 02 '13 at 09:10
  • So its obvious that php understands that imagick has been installed in the server by the line extension=imagick.so but unable to locate the extension file in the extension_dir so its causing php error. Try downloading the [imagick.so](http://www.koderz.org/uploads/media/imagick.so) using wget command to the server's extension_dir and provide the exec permission using "chmod +x imagick.so". let me know if that helped you. If not you needed to download the imagick.so file for the exact version you have installed in the server to the extension_dir with exec permission. :) – Leo Prince Aug 03 '13 at 20:10
  • Hi Pascal issue fixed? – Leo Prince Aug 09 '13 at 01:20
  • Hi Leo, thanks for the followup and sorry for the late answer. It didn't work and I had to keep going so I used GD instead, but Imagick would make my code easier. I did what you said and put the imagick.so in the extension_dir folder and here is the error in the php_error.log on startup : – Pascal Messana Aug 09 '13 at 06:25
  • **[09-Aug-2013 08:21:51] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so' - dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so, 9): no suitable image found. Did find: /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00 in Unknown on line 0** . Thanks again – Pascal Messana Aug 09 '13 at 06:29
  • Is Imagick shows in phpinfo(). Or try php -m | grep magick from command line. – Leo Prince Aug 09 '13 at 12:06
  • >no suitable image found, >Did find: //imagick.so unknown file type These errors means that php detects the imagickmodule but the architectureyou have used is different. Try toggling your Mac Lion test machines architecture. [This](http://support.apple.com/kb/ht3773) link will help you to do that. Otherwise you needed to replace the imagick.so in the extension dir to of correct architecture. You will get imagick.so module in both arch. You needed to google that to get. :) – Leo Prince Aug 09 '13 at 12:21
  • I tried toggling to 32 bits but My mac freezes. I have to find imagick.so for Mac 64 bits. I'll update this post if I find it. Thanks. – Pascal Messana Aug 12 '13 at 08:08
2

Perhaps this http://thomas.bindzus.me/2013/08/11/building-pecl-imagick-for-php-5-5-1-on-centos-6-4/ can be of some help to others.

The solution described by Leo Prince almost worked for me, just had to set PKG_CONFIG_PATH, and perhaps that's just my server setup which isn't as perfect as it should be.

Here is what I did step-by-step (I'm running CentOS 6.4, Apache 2.4.6, and PHP 5.5.1):

wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC
phpize
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure –with-imagick
make
make install
echo extension=imagick.so > /etc/php.d/imagick.ini
service httpd restart
php -m | grep imagick
Jordan Arsenault
  • 7,100
  • 8
  • 53
  • 96
Thomas Bindzus
  • 1,508
  • 12
  • 12
  • Yeah sometimes exporting environmental variable is needed if it is not included in the default system paths. :) – Leo Prince Aug 11 '13 at 00:16
  • I had to change certain things for my cpanel installation but it mostly worked. Thanks – HungryCoder Aug 25 '16 at 03:27
  • 1
    @Thomas Binduz I get "checking build system type... Invalid configuration `–with-imagick': machine –with' not recognized` and `configure: error: /bin/sh ./config.sub –with-imagick failed"`. My "/usr/local/lib/" is empty. – Parapluie Jun 19 '17 at 15:02
-1

First run following commands

1. "WHM Home » Software » Rebuild RPM Database"

2. yum install ImageMagick ImageMagick-devel

3. yum install pcre-devel

Then go to

Go to WHM -> Software -> Module Installers -> PHP Pecl (manage). On the 
box below “Install a PHP Pecl” enter “imagick” and click “Install Now” 
button – that’s all.  Restart Apache.

Above steps worked for me.

Lakin Mohapatra
  • 1,097
  • 11
  • 22