Table of contents

Linux install PHP error: no acceptable C compiler found in $PATH when installing php

PHP May 20, 2020 Viewed 590 Comments 0

Question

When I installing PHP 7.4.6 under Linux, I got an error.

$ 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

Solution

The gcc compiler is not in my $PATH. It means either I don't have gcc installed or it's not in my $PATH variable.

To install gcc use this: (run as root)

  • RHEL / CentOS

Install Development Tool.

sudo yum groupinstall "Development Tools"

Or install gcc only.

sudo yum install gcc
  • Ubuntu / Debian
sudo apt-get install build-essential
Updated Jul 01, 2020