PECL安装失败

8
我浏览了所有谷歌搜索结果,阅读了有关此错误的所有论坛帖子,但我无法解决它。
当使用PECL安装任何东西时,我总是遇到这个错误:
checking whether the C compiler works... configure: error: cannot run C compiled programs.

一切顺利进行到那个点,然后砰!

我正在使用CentOS 4.3,PEAR是最新的稳定版本,GCC也是一个稳定和最近的版本。一切都正常工作,但C编译器似乎总是出错。我尝试通过暂时启用它来使tmp拥有正确的操作权限:

mount -o remount,exec,suid /tmp

但是那并不起作用。

我已经尝试了所有被建议的方法,但都无济于事。有什么想法吗?


显而易见的问题。你能运行C编译的程序吗?你编译过一个hello-world应用程序(或其他任何东西)吗?echo 'int main(){printf("Hello, world!\n");}'|gcc -x c - -o hello && ./hello - Matthew Flaschen
[root@giglocator ~]# echo 'int main(){printf("Hello, world!\n");}'|gcc -x c - -o hello && ./hello <stdin>: 在函数 'main' 中: <stdin>:1: 警告: 内置函数 'printf' 的不兼容隐式声明 Hello, world!\n [root@giglocator ~]# - James
但是我确定它可以运行C编译的应用程序,当不使用PECL时,我已经编译了许多其他应用程序。 - James
顶一下?小伙伴们,我真的需要帮助!还有人有更多的想法吗? - James
3个回答

9

我使用的是Centos 5.3系统,成功安装PECL(例如APC),方法是在/tmp和/var/tmp目录上移除noexec标志。

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

仅在/tmp上进行此操作并不起作用-我仍然收到错误消息“检查C编译器是否工作...配置:错误:无法运行C编译的程序。”

请记得在安装完成后再次使用noexec重新挂载。


7
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

我很快地写好了这个并且通过一些手动的操作安装了APC。例如将模块复制到PHP模块中并在php.ini中添加扩展。现在完美运行。


这对我很有用,要安装oauth扩展,我首先需要安装pcre-d,我使用以下命令进行安装:yum install pcre pcre-d。以防万一其他人遇到同样的问题。 - Tyler Egeto

2

当我安装MongoDB驱动遇到类似问题时,以下方法对我有用:

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

然后:

sudo sudo pecl install XXX

这不会打开安全漏洞,因为只有root用户可以在这两个目录中创建可执行文件。

注意以下操作不适用于PECL:

sudo pear config-set temp_dir /var/tmp/pear/temp

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接