在Linux下编译安装php

在linux下编译安装php时的报错

checking libxml2 install dir... no
checking for xml2-config path... 
configure: error: xml2-config not found. Please check your libxml2 installation.

检查是否安装了libxm包

rpm -qa | grep  libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12

重新安装libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

安装完之后查找xml2-config文件是否存在

find / -name "xml2-config"
/usr/bin/xml2-config

如果存在的话则可以重新安装php

sudo ./configure --prefix=/home/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr

其中:

  --with-apxs2指向apache web server所在的安装路径

  --with-mysql指向mysql的header files所在的路径

(如果configure提示configure: error: Cannot find MySQL header files,

说明你制定的路径没有找到头文件,

可以先使用find / -name mysql.h 找一下,

如果没有,就快到mysql网站下载下面这个安装吧:

 

configure运行成功的标志是

之后再进行编译&安装

sudo make && sudo make install

原文地址:https://www.cnblogs.com/liupengblog/p/2555453.html