Installare imagemagick con l’estensione imagick per PHP su CentOS

Per installare imagemagick con l’estensione imagick per PHP su una CentOS è sufficiente seguire questi passi:
yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick

Nel caso in cui abbiate questo errore:
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

Date un’occhiata alla vostra directory /tmp… quasi sicuramente è montata con il flag noexec. Remount it without noexec e riprovate:
mount -o remount,rw /tmp

Una volta terminata l’installazione, create un file di inclusione per il modulo imagick.so e riavviate apache:
echo "extension=imagick.so" > /etc/php.d/imagick.ini
/etc/init.d/httpd restart

Testate il corretto caricamento del modulo imagick tramite:
php -m | grep imagick

12 commenti

  1. 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?

  2. 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!

  3. Thank for this! I was looking this long time!

  4. It worked! Thank you

  5. Job

    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

  6. 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.

  7. @Curtis Just install ImageMagick from source and re-try pecl install.

  8. I needed this to run my ne webstie ;) Thanks in advance!

  9. 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.

  10. 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

  11. Parikshit, you need to install also autoconf and m4 to fix your issue.