PHP 7.4 错误 Package requirements (libcurl >= 7.15.5) were not met

Linux 2020-05-23 阅读 340 评论 0


在 Linux 编译 php-7.4.6,./configure --prefix=/opt/php-7.4.6 --with-pdo-mysql --enable-fpm --with-curl,最后出现以下错误。

checking for libcurl >= 7.15.5... no
configure: error: Package requirements (libcurl >= 7.15.5) were not met:

Package 'libcurl', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables CURL_CFLAGS
and CURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.


需要安装 libcurl-devel,可以手动安装或者命令行安装。

1. 手动安装 页面中,找到与操作系统相对应的 libcurl-devel 版本,并下载安装。

2. 命令行安装

  • Ubuntu / Debian
sudo apt-get install libcurl4-openssl-dev
  • RHEL / CentOS
sudo yum install libcurl-devel
  • Mac OS

使用 HomeBrew 安装

brew install curl

重新编译,带上 --with-curl=curl路径

./configure --prefix=/opt/php-7.4.6 --with-pdo-mysql --enable-fpm --with-curl=/usr/local/Cellar/curl/7.70.0
最后更新 2020-06-09