2

I am trying to install ImageMagick on my dedicated-virtual Centos server for use with PHP.

  1. I first ran the following commands successfully:

    # yum install gcc php-devel php-pear
    # yum install ImageMagick ImageMagick-devel
    
  2. Then, I ran this command:

    # pecl install imagick
    
  3. After I ran it, I got this error:

    downloading imagick-3.1.2.tgz ... Starting to download imagick-3.1.2.tgz (94,657 bytes) .....................done: 94,657 bytes 15 source files, building running: phpize Configuring for: PHP Api Version: 20100412 Zend Module Api No: 20100525 Zend Extension Api No: 220100525 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

  4. So, I google'd it and found that I should do this:

    If you see this error, it most likely means the server’s /tmp directory does not allow executables to run. Set a different temporary directory on a filesystem on which you can execute binaries. For instance: pear config-set temp_dir /root/tmp

    Then re-run: pecl upgrade-all

    Ref. https://opdk.info/faqs/error-shown-during-install-shtool-%E2%80%98vartmpimagickbuildshtool%E2%80%99-does-not-exist-or-not-executable

  5. So, I created a new directory in my root and changed the PEAR config variable like so:

    # mkdir rw ../tmp2
    # pear config-set temp_dir ../tmp2
    

But, now, after trying to install again I get this error:

# pecl install imagick
downloading imagick-3.1.2.tgz ...
Starting to download imagick-3.1.2.tgz (94,657 bytes)
.....................done: 94,657 bytes
ERROR: SECURITY ERROR: file config.m4 (installed to ../tmp2/imagick/config.m4) contains 
parent directory reference ..

How can I fix this? I just want to install ImageMagick.

  • 2
    Have you tried this with absolute path reference to temporary directory, instead of using a relative one? – Sami Laine Jan 19 '14 at 13:28
  • Thanks so much. That actually solved it! You can post an answer if you'd like, and I'll accept – user1477388 Jan 19 '14 at 13:34
  • @SamiLaine By the way, would it hurt to leave pear config-set temp_dir ../tmp2 at tmp2 instead of whatever the default is? – user1477388 Jan 19 '14 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.