Question

I have browsed every Google result, read all the forum posts about this error, but I cannot solve it.

When using PECL install for anything, I always end up getting this error:

checking whether the C compiler works... configure: error: cannot run C compiled programs.

Everything else succeeds up to that point them bam!

I'm using CentOS 4.3, PEAR is the latest stable version, GCC is a stable and recent version. Everything is working as it should, but the C compiler always seems to error. I've tried to make tmp have the right privilages for the operation by temporarily enabling it using:

mount -o remount,exec,suid /tmp

But that doesn't work.

I've literally tried everything that has been suggested by to no avail. Any ideas?

Was it helpful?

Solution 2

cd ~
mkdir setups
cd setups
wget http://pecl.php.net/get/APC-3.1.2.tgz
tar -xvf APC-3.1.2.tgz
cd APC-3.1.2
phpize && ./configure --with-apxs && make

I quickly wrote that up and was able to install APC with a bit of manual work. Such as copying the module to PHP modules and adding the extension to the php.ini. Works perfectly now.

OTHER TIPS

I'm on Centos 5.3 and I was able to get PECL installers running (APC in my case) successfully by removing the noexec flag on both /tmp and /var/tmp

mount -o remount,exec,suid /tmp
mount -o remount,exec,suid /var/tmp

Doing this only on /tmp didn't work - I still received the error "checking whether the C compiler works... configure: error: cannot run C compiled programs."

Remember to run these remounts again with noexec after your install finishes.

When I had similar problems installing the MongoDB driver, this worked for me:

sudo mkdir /root/tmp.pear
sudo mkdir /root/tmp.pear-build-root

sudo ln -s /root/tmp.pear /tmp/pear
sudo ln -s /root/tmp.pear-build-root /tmp/pear-build-root

Then:

sudo sudo pecl install XXX

(This doesn't open a security hole because only root can create executables in those two directories.)

Note that the following does not work for PECL:

sudo pear config-set temp_dir /var/tmp/pear/temp
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top