ImageMagick - PECL issue - Cannot locate header file MagickWand.h
Asked Answered
A

5

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 ?

Anticlinorium answered 24/7, 2013 at 14:26 Comment(0)
U
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.

Underhanded answered 17/2, 2017 at 14:15 Comment(1)
this appears to also work fine on C8 using dnf -y install IMageMagick-devel. thanks for sharing.Severalty
Y
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
Yurik answered 16/8, 2017 at 8:59 Comment(0)
P
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
Priapus answered 25/7, 2013 at 4:12 Comment(15)
You can easily install the imagick using yum. try "yum install ImageMagick ImageMagick-devel"Priapus
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 ?Duplicate
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.Priapus
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.Duplicate
Here is pretty good way for Mamp Go through the steps and try to finish installation. All the best :)Priapus
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 ?Duplicate
That means imagick.so module is not loading by your php. what is your php version? Put a phpinfo 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?Priapus
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 !Duplicate
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 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. :)Priapus
Hi Pascal issue fixed?Priapus
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 :Duplicate
[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 againDuplicate
Is Imagick shows in phpinfo(). Or try php -m | grep magick from command line.Priapus
>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 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. :)Priapus
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.Duplicate
B
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
Barbary answered 10/8, 2013 at 18:31 Comment(3)
Yeah sometimes exporting environmental variable is needed if it is not included in the default system paths. :)Priapus
I had to change certain things for my cpanel installation but it mostly worked. ThanksHolliehollifield
@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.Pros
M
-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.

Mental answered 7/3, 2018 at 10:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.