安装 PDO PHP 模块时出现“无法运行 C 编译的程序”错误

安装 PDO PHP 模块时出现“无法运行 C 编译的程序”错误

我有一个 cPanel 服务器,我想在其上安装一些软件包。我以 root 身份连接到服务器并运行以下命令来更新和删除所有现有存储库:

yum update
yum clean all
rm -f /etc/yum.repos.d/*
rm -rf /var/cache/yum/*

我的最后一个命令是安装 PDO PHP 模块,但此时我收到了错误:

root@linux [~/TMP]# pecl install pdo
WARNING: "pecl/PDO" is deprecated in favor of "channel://http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo//ext/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 grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/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: in `/var/tmp/pear-build-root/PDO-1.0.3':
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
root@linux [~/TMP]# pecl install bdoNo releases available for package "pecl.php.net/bdo"
install failed

是什么原因导致此错误?我该如何修复它?


编辑:另外,当我运行时yum install php*,在检查依赖关系后我得到:

--> Finished Dependency Resolution
Error: Package: rrdtool-php-1.3.8-6.el6.x86_64 (base)
           Requires: php(zend-abi) = 20090626

编辑: 我上传了我的配置日志配置状态文件

答案1

您必须安装包含编译所需的开发工具的软件包。您可以一一安装它们:

yum install gcc
yum install make
...
yum install glibc-devel

或者您可以在一个命令中安装其中很多:

yum groupinstall "Development Tools"

答案2

这篇博文似乎有了答案。

我没有安装 cc,而是安装了 gcc,这对我有用。

yum install gcc
pecl install pdo

相关内容