PECL Install Issues on Redhat

Installing via the pecl command can be a pain on Redhat. First off all you will need to install the php-devel package:

yum install php-devel

Then you will need ensure that the PEAR/PECL installer is at the latest version so as root run:

pear update-channel pear.php.net
pear upgrade pear

You may need to force pear to upgrade itself by using:

pear upgrade —force pear

I had to use the —force option because my version of PEAR was so old that the installer thought my version of Tar_Archive might not have been up to muster. It was however.

With all this in place you are ready to attempt to install your chosen extension:

pecl install ssdeep

If you get something like the following back:

/usr/bin/phpize: /tmp/ssdeep/build/shtool: /bin/sh: bad interpreter: Permission

Then it is likely that your temporary directory is mounted in a safer noexec state, which means that you cannot execute scripts within the /tmp directory. To test this you can put a simple bash script into your /tmp directory and chmod it with +x. I used the following bash script:

#!/bin/bash
echo “SIMON” 

If you do not get SIMON back when you execute the file, but an error like “/bin/sh: bad interpreter: Permission” then the directory is set to noexec.

There are a few ways to overcome this with the easiest being to:

  1. Remount the directory as exec:
    mount -o remount,exec /tmp
  2. Install your pecl extension
    pecl install ssdeep
  3. Remount the directory as noexec again for safety
    mount -o remount,noexec /tmp

There are a variety of other ways to get this working documented in the Media Temple wiki pages if the above technique does not work for you.