tags:

views:

1139

answers:

7
+1  Q: 

PECL install fails

Hey!

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?

A: 

Obvious question. Can you run C-compiled programs? Have you compiled a hello-world app (or anything else)?

echo 'int main(){printf("Hello, world!\\n");}'|gcc -x c - -o hello && ./hello
Matthew Flaschen
James
But yes I am sure it can run C-compiled apps, when not using PECL I have compiled a number of other apps.
James
+2  A: 
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.

James
This has worked for me, to install the oauth extension I first needed to install: pcre-d, I did this with: yum install pcre pcre-d. Just in case someone has the same problem.
Tyler Egeto
+2  A: 

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.

Steven
+1  A: 

Steven's answer worked for me as well. See http://blog.ntrippy.net/2008/06/installing-peclpear-php-modules-on-rhel.html for more technical details.

Evan Donovan
A: 

Steven's answer worked for me as well! Thanks Steven! Iv'e been trying to fix this for awhile :D

Cilice11
Vote his answer up instead
enobrev
A: 

I am also trying to install something (pdo_mysql extension) with pecl and the workaround with phpize && ./configure && make is working untill the point I get this error:

checking for mysql_query in -lmysqlclient... no configure: error: mysql_query missing!?

Does anyone know a solution for this? The server is running on CentOS 4 and the mysql version is MySQL 5.1.34

thx

--------edited -----------

Found the solution, I used the wrong mysql installation, I am running a 64 bit server and installed the mysql version of 32 bit :p

A: 

Steven's answer worked here too, thanks!

Thanos
Vote his answer up instead
enobrev