When attempting to compile using PECL install, you will likely get an error stating:
checking whether the C compiler works… configure: error: cannot run C compiled programs.
This is due to the environment CentOS and Redhat flavors have for the /tmp directory. Rather than remounting /tmp without exec, you can compile the module manually on the user account. In this example, I’m compiling and installing the APC module. NOTE: ensure you are doing this ON the user’s account and not as root unless you want the module installed server wide.
tar -xvf APC-3.1.2.tgz
phpize && ./configure –with-apxs && make
This will compile the module successfully, without the need to write or execute compiled programs in /tmp. Now simply add the extension to php.ini and ensure it loads in phpinfo().