2

我正在尝试在 Linux 上安装 PECL 包,但安装程序永远不会超过配置阶段。

我的托管服务提供商在 /var/tmp 上安装了一个文件系统,阻止文件执行,这导致了这个错误:

root@host [/usr/local/apache/conf/includes]# 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
building in /var/tmp/pear-build-root/PDO-1.0.3
running: /root/tmp/pear/PDO/configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/root/tmp/pear/PDO/configure' failed

我 99% 确定问题是您无法执行 /var/tmp 中的文件(我在这里复制了一个可执行文件并尝试验证)。如果我让 PECL 在其他地方进行构建工作,我确信我可以完成它,但我找不到合适的配置设置。

你如何告诉 PECL 在非默认文件夹中构建?

4

3 回答 3

2

哇,你为什么要从 PECL 安装 PDO?自 5.1 以来 PDO 已内置到 PHP 中。你在运行 5.0 吗?

如果您运行的是 5.1 或更高版本并且缺少 PDO,则可能是:

  1. 您的 PHP 副本是在没有它的情况下编译的,必须重新编译;或者
  2. 您的 PHP 副本是从您的操作系统存储库安装的,没有 PDO 模块

如果为 1,您需要从头开始重新编译 PHP,或者只编译共享模块并将其复制到正确的位置。

如果是 2,您只需要安装操作系统的 PDO 扩展。在 RHEL 和 CentOS 下,尝试yum search php-pdo. 我不知道为其他发行版调用包安装程序的正确语法,但该包几乎肯定会包含字符串“php-pdo”。(提示:如果你的 PHP 来自你的操作系统,他们也可能提供常见的 PECL 包。尝试在他们的存储库中搜索“pecl”。)

最后,如果您正在运行 5.0……为了这个世界上所有美好的事物,请升级!请先通读PHP 手册中的升级说明,以防您不小心使用了旧行为。

(另外,要重新配置 pecl,请尝试pecl config-show查看可用的设置,然后用 apecl config-set ...更改设置。 不要尝试为高于 5.0.x 的 PHP 版本安装 PDO 扩展,它损坏. 甚至还有一个很大的PECL 网站上 PDO 页面顶部的胖框。)

于 2010-06-22T23:58:28.907 回答
2

上面的答案可能对用户有所帮助,但对那些遇到 /tmp 目录的“noexec”问题的人没有帮助。

以下是 pecl install [program] 失败并显示“配置错误无法运行 c 编译程序”的方法,因为您无法执行 /tmp 目录中的内容:

首先打开 exec 选项重新挂载 /tmp 目录: mount -o,remount,rw,exec /tmp

二、安装你的pecl扩展:pecl install [extension name]

第三,完成后,您应该使用以下命令将其设置回“noexec”:mount -o,remount,rw,noexec /tmp

于 2011-08-05T21:07:08.770 回答
0

在我的例子中,/tmp 是 noexec,/var 是可执行的。

main10:~# mv /tmp/pear /var/tmp

main10:~# ln -s /var/tmp/pear /tmp/pear

它解决了这个问题。

于 2014-04-23T10:08:31.693 回答