Linux 安装 PHP 出错 no acceptable C compiler found in $PATH when installing php

Linux 2020-05-19 阅读 6 评论 0

问题描述

在 Linux 下安装 PHP 时,报错了,具体步骤如下:

$ wget https://www.php.net/distributions/php-7.4.6.tar.gz
$ tar xf php-7.4.6.tar.gz
$ cd php-7.4.6
$ ./configure --prefix=/develop/opt/php-7.4.6 --enable-fpm --with-pdo-mysql
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... no
checking for gcc... no
configure: error: in `/home/test/Downloads/package/php-7.4.6':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

解决方法

gcc 编译器不在 $PATH 中,这意味着系统没有安装 gcc 或不在 $PATH 变量中。

可以安装开发工具,开发工具中包含有 gcc 编译器。

  • RHEL / CentOS

安装开发工具

sudo yum groupinstall "Development Tools"

或者单独安装 gcc 

sudo yum install gcc
  • Ubuntu / Debian
sudo apt-get install build-essential
最后更新 2020-05-19