编译安装php时出现以下错误:是因为--with-libxml-dir 无法引用到libxml2

/root/src/php/ext/dom/node.c: In function 'dom_canonicalization':

/root/src/php/ext/dom/node.c:1953: error: dereferencing pointer to incomplete type

/root/src/php/ext/dom/node.c:1955: error: dereferencing pointer to incomplete type


解决方法:


方法1、配置时去掉--with-libxml-dir 这个选项。但没有但没有DOM和XML。


方法2、如果需要DOM和XML。则配置--with-libxml-dir=libxml2安装目录/include/libxml2/libxml

       如果是yum安装的libxml2 。则配置为--with-libxml-dir=/usr/include/libxml2/libxml
      (注意安装好libxml2-devel)


 如果以上方法不行,请尝试删除当前目录,重新解压php包,在按照上述方法再进行配置编译。