Install imagemagick with PHP imagick extension on CentOS
Posted by Matteo Mattei ~ 8th October 2008
To install imagemagick with PHP imagick extension on Linux CentOS you must follow these steps:
yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick
If you have an error like this:
root@myhost [~]# pecl install imagick
downloading imagick-3.0.1.tgz ...
Starting to download imagick-3.0.1.tgz (93,920 bytes)
.....................done: 93,920 bytes
13 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Please provide the prefix of Imagemagick installation [autodetect] :
building in /var/tmp/pear-build-root/imagick-3.0.1
running: /root/tmp/pear/imagick/configure --with-imagick
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/root/tmp/pear/imagick/configure --with-imagick' failed
Look at your /tmp folder… pretty surely it is mounted with noexec flag. Remount it without noexec and retry:
mount -o remount,rw /tmp
At the end of the installation, create an inclusion file for imagick.so module and restart apache:
echo "extension=imagick.so" > /etc/php.d/imagick.ini
/etc/init.d/httpd restart
Test the correct loading of the imagick module with:
php -m | grep imagick
Thanks for some quality points there. I am kind of new to online , so I printed this off to put in my file, any better way to go about keeping track of it then printing?
Do you people have a facebook fan page? I looked for one on twitter but could not discover one, I would really like to become a fan!
Thank for this! I was looking this long time!
It worked! Thank you
Using this method.. no need to edit the php.ini?
You don’t need to edit php.ini directly.
The module inclusion is done in /etc/php.d/imagick.ini
Just went through this. Just a note for those on CentOS 5.6 (probably more), you’ll want to run ‘yum install ImageMagick-devel’ (for some reason yum install ImageMagick-devel.i386 didn’t work) to avoid the following error: ‘configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.’
Also, incase you don’t have it, if pecl doesn’t work, run ‘yum install php-pear’. I know, noobish, but pertinent.
@Curtis Just install ImageMagick from source and re-try pecl install.
I needed this to run my ne webstie
Thanks in advance!
This web site is truly a walk-through for all of the information you wanted about this and didnt know who to ask and my seotons. Glimpse here, and youll definitely discover it.
Hello,
I am running the command but as soon as I run it, it is giving me a weird error:
pecl install imagick
downloading imagick-3.0.1.tgz …
Starting to download imagick-3.0.1.tgz (93,920 bytes)
………………done: 93,920 bytes
13 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
cp: cannot stat `mkdep.awk’: No such file or directory
cp: cannot stat `scan_makefile_in.awk’: No such file or directory
cp: cannot stat `shtool’: No such file or directory
cp: cannot stat `libtool.m4′: No such file or directory
cp: cannot stat `acinclude.m4′: No such file or directory
cp: cannot stat `Makefile.global’: No such file or directory
cp: cannot stat `config.sub’: No such file or directory
cp: cannot stat `config.guess’: No such file or directory
cp: cannot stat `ltmain.sh’: No such file or directory
cp: cannot stat `run-tests*.php’: No such file or directory
cat: acinclude.m4: No such file or directory
cat: ./build/libtool.m4: No such file or directory
/usr/bin/phpize: line 154: /usr/lib64/php/build/phpize.m4: No such file or directory
chmod: cannot access `/var/tmp/imagick/build/shtool’: No such file or directory
shtool at ‘/var/tmp/imagick/build/shtool’ does not exist or is not executable.
Make sure that the file exists and is executable and then rerun this script.
ERROR: `phpize’ failed.
Can anyone help me with this issue?
Thanks for looking.
Parikshit
Parikshit, you need to install also autoconf and m4 to fix your issue.