Problem installing PECL PHP extensions while /tmp is secured



I recently tried to install a PHP PECL extension on a server I manage, when I received this error:

[root@xxxx PDO-1.0.3]# pecl install pdo
downloading PDO-1.0.3.tgz ...
Starting to download PDO-1.0.3.tgz (52,613 bytes)
.............done: 52,613 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/PDO/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
[root@xxxx PDO-1.0.3]#

After some searching, I figured out this is because I had set /tmp to noexec to keep any intruders from executing files from this directory. I suspect the same error will occur with any PECL extension installation. I temporarily turned it off with the command:

mount -oremount,exec /tmp

Now PECL installs extensions fine. Don’t forget to reenable noexec when you are done!

  • Pingback: Dave Drager()

  • Marcus Gilroy-Ware

    Hi David, couldn’t get this to work but thanks anyway. What distribution were you using? Marcus

  • Marcus Gilroy-Ware

    Hi David, couldn’t get this to work but thanks anyway. What distribution were you using? Marcus