How to Fix PECL PHP Error: /bin/sh: bad interpreter: Permission denied
I recently tried installing xdebug on a RHEL 4 machine, and somehow, the server decided that it should refuse having xdebug installed. As if running a heavy Java app is not enough, I decided to add more processes for the server to run. And it looks like the server has got me:
[root@server src]# pecl install xdebug
downloading xdebug-2.0.5.tgz ...
Starting to download xdebug-2.0.5.tgz (287,621 bytes)
.............done: 287,621 bytes
12 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
/usr/local/bin/phpize: /tmp/pear/temp/xdebug/build/shtool: /bin/sh: bad interpreter: Permission denied
So, like I always do, I tackle the problem with my handy tool: Google. I found out that this error occurs when /tmp is mounted as read-only (ro). You can check this by looking at the /etc/fstab file and check the /tmp partition.
Okay, now I know what the problem is. How do I get over this?
Lazy that I am, I moved the /tmp/pear directory, and create a symlink to the root directory.
[root@server src]# mv /tmp/pear /tmp/pear-ori
[root@server src]# mkdir /root
[root@server src]# ln -s /tmp/pear /root/tmp/pear
Now that the directory from where the PECL scripts are running is in /root, the installation should go smoothly.
Another way to go around this is to remount the /tmp:
[root@server src]# mount -oremount,exec /tmp
I have not tried the above command because I thought that creating symlink is a safer approach rather than messing with the mounts.
If there are other ways to fix this, let me know using the comment box below.
Related Posts
2 Comments to “How to Fix PECL PHP Error: /bin/sh: bad interpreter: Permission denied”
Post comment
Search PinoyTux
Subscribe to Email Feeds
Blog Lounge
Popular Posts
Recent Posts
Drop your Card Here
Recent Comments
- Anidich1 on Tip: Add User and Generate Password Script
- Tom S on Cebu Pacific Sucks
- kadersardar on PinoyTux Spreads Some CommentLuv
- Steve on Creative Labs Threatens Third Party Driver Modder
- Barry on Free Laptops with Broadband Connection









Almost. The failure of pear was because of the “noexec” option on /tmp rather than its being readonly. In fact, it’s not readonly as you were able to move directories around and make symbolic links. Those actions would have failed if the /tmp drive was readonly.
Specifically, the line:
/usr/local/bin/phpize: /tmp/pear/temp/xdebug/build/shtool: /bin/sh: bad interpreter: Permission denied
…is what happens when you try to exec a script anywhere under /tmp when it’s mounted with the “noexec” option.
% mount -oremount,exec /tmp
% pecl install xdebug
% mount -oremount,noexec /tmp
Also – its good practice to lock /tmp back down after changing the option so pecl will work.
Best regards,
-pbr
[...] Here’s the details, straight from http://www.pinoytux.com/linux/how-to-fix-pecl-php-error-binsh-bad-interpreter-permission-denied [...]