PHP 7.4 configure 错误 configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met

Linux 2020-05-21 阅读 460 评论 0

问题描述

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

checking whether to build with LIBXML support... yes
checking for libxml-2.0 >= 2.7.6... no
configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:

Package 'libxml-2.0', 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 LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

解决方法

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

1. 手动安装

https://pkgs.org/download/libxml2-devel 页面中,找到与操作系统相对应的 libxml2-devel 版本,并下载安装。

2. 命令行安装

如 Ubuntu / Debian:

sudo apt-get install libxml2-dev

RHEL / CentOS:

sudo yum install libxml2-devel
最后更新 2020-05-22
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });