The default RHEL 5.2 installation does not come with xdebug as part of any of the php RPMs. A quick look around the Net also provided no real RPM candidates that I could use on this system so I had to fall back to using the package management tools (pecl and pear) provided by php.
$ sudo pecl install xdebug downloading xdebug-2.0.3.tgz ... Starting to download xdebug-2.0.3.tgz (286,325 bytes) ...........................................................done: 286,325 bytes 66 source files, building running: phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 /usr/bin/phpize: /tmp/pear/download/xdebug-2.0.3/build/shtool: /bin/sh: bad interpreter: Permission denied Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script. ERROR: `phpize' failed
Yep, loving it already!
Why on earth am I not able to invoke /bin/sh (as can be seen by the ‘/bin/sh: bad interpreter: Permission denied’ error above)? Let’s see if root can actually run the shell interpreter:
$ sudo /bin/sh sh-3.2# exit
OK, everything looks good. Why is it breaking when we’re trying to run the interpreter from /tmp/pear/download/xdebug-2.0.3/build/shtool?
Back to basics
Perhaps this has something to do with where we’re trying to run it from and the user we’re doing the installation as (root) seems to be capable of running the interpreter but not from the shtool script for some reason.
$ ls -ld /tmp/ drwxrwxrwt 17 root root 4096 Jun 18 07:41 /tmp/
Obviously _not_ a permissions issue.
$ grep tmp /etc/fstab /dev/sda2 /tmp ext3 defaults,nosuid,nodev,noexec 1 2
Ah, there you are! /tmp is mounted with a ‘noexec’ flag so that’s what’s causing the execution to fail when we try to install xdebug via pecl. No problem, I’ll just set pecl to use /var/tmp instead … oh, wait, on RHEL systems /var/tmp is just a symlink to /tmp.
Hand me half a brick
Time to work around the issue. Let’s go find those directories pear expects to be somehow related to /tmp or /var/tmp:
$ pear config-show | grep tmp PEAR Installer download download_dir /tmp/pear/download PEAR Installer temp directory temp_dir /var/tmp
$ pear config-set download_dir /root/tmp/pear/download $ pear config-set temp_dir /root/tmp
I updated these to temporarily point elsewhere:
$ pecl config-show | grep tmp PEAR Installer download download_dir /root/tmp/pear/download PEAR Installer temp directory temp_dir /root/tmp
$ sudo mkdir -p /root/tmp/pear/download