PHP 7.4 configure: error: The pkg-config script could not be found or is too old
Issue
In Linux and Mac Os, I compile the source code of PHP 7.4.9. Run the following commands.
$ ./configure --prefix=/opt/php-7.4.9 --enable-fpm --with-pdo-mysql --with-zip --with-curl --enable-mbstring
I get the error message saying:
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
Solution
It needs pkg-config
.
Ubuntu/Debian
apt install pkg-config
Redhat/Centos
yum install -y pkgconfig
Archlinux OS
pacman -S pkgconf
Mac OS
brew install pkg-config