编译php报错xml2-config not found. Please check your libxml2 installation
编译php报错xml2-config not found. Please check your libxml2 installation
checking size of long... (cached) 4
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking which regex library to use... php
checking whether to enable LIBXML support... yes
checking libxml2 install dir... /usr
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
解决方法:
检查是否安装了libxm包
[root@XKWB3403 php-5.3.8]# 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文件是否存在
[root@XKWB3403 php-5.3.8]# find / -name "xml2-config"
/usr/bin/xml2-config
如果存在的话重新安装php
[root@XKWB3403 php-5.3.8]# ./configure
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating sapi/fpm/php-fpm.conf
creating sapi/fpm/init.d.php-fpm
creating sapi/fpm/php-fpm.8
creating sapi/fpm/status.html
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
Notice: Following unknown configure options were used:
--enable-discard-path
--enable-fastcgi
--enable-force-cgi-redirect
Check './configure --help' for available options
特别注意:编译php时需要解决依赖关系,所以在编译之后先要安装php所需的关系组件。
解决方法2
在编译PHP 的时候可能会出现找不到套件或套件错误的错误讯息。
找不到apxs 路径
在重新编译PHP时出现找不到apxs路径的错误讯息:
./configure: /usr/sbin/apxs: No such file or directory
解决方式如下:
1.安装Apache的扩展套件apxs,这是httpd-devel之中的一个套件,可以用yum将其安装:
# yum -y install httpd-devel
2.利用指令确认安装位址:
# which apxs
/use/sbin/apxs
找不到xml2-config
在编译PHP的时候出现找不到xml2-config的错误讯息:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决方式:
使用yum安装libxml2及libxml2-devel套件:
# yum -y install libxml2 libxml2-devel
OpenSSL 错误
错误讯息:
Checking for pkg-config… /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's
重新安装openssl及openssl-devel:
# yum install openssl openssl-devel
Bzip2 错误
错误讯息:
Configure: error: Please reinstall the BZip2 distribution
如果出现Bzip2的错误,可以重新安装bzip2。
因为yum找不到bzip2套件,可直接去官网下载:
http://www.bzip.org/
下载完后执行安装:
# tar zxvf bzip2-1.0.5.tar.gz
# cd bzip2-1.0.5
# make install
# yum -y install openssl-devel
gmp 错误
错误讯息:
configure: error: Unable to locate gmp.h
重新安装gmp-devel:
# yum -y install gmp-devel
curl 错误
错误讯息:
Configure: error: Please reinstall the libcurl distribution -
easy.h should be in
重新安装curl-devel:
# yum install curl curl-devel
libjpeg 错误
错误讯息:
Configure: error: libjpeg.(also) not found.
重新安装libjpeg-devel及libjpeg:
# yum install libjpeg libjpeg-devel
libpng 错误
错误讯息:
Configure: error: libpng.(also) not found.
重新安装libpng-devel及libpng:
# yum install libpng libpng-devel
freetype 错误
错误讯息:
Configure: error: freetype.h not found.
重新安装freetype-devel:
# yum install freetype-devel
libmcrypt 错误
错误讯息:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
重新安装libmcrypt及libmcrypt-devel:
# yum install libmcrypt libmcrypt-devel
MySQL 错误
错误讯息:
Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
重新安装mysql-devel:
# yum install mysql-devel
ncurses 错误
错误讯息:
Configure: error: Please reinstall the ncurses distribution
重新安装ncurses及ncurses-devel:
# yum install ncurses ncurses-devel
unixODBC 错误
错误讯息:
Checking for unixODBC support… configure: error: ODBC header file '/usr/include/sqlext.h' not found!
重新安装unixODBC-devel:
# yum install unixODBC-devel
pspell 错误
错误讯息:
Configure: error: Cannot find pspell
重新安装pspell-devel:
# yum install pspell-devel
mcrypt 错误
错误讯息:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
重新安装libmcrypt及libmcrypt-devel:
# yum install libmcrypt libmcrypt-devel
snmp 错误
错误讯息:
Configure: error: snmp.h not found. Check your SNMP installation.
重新安装net-snmp及net-snmp-devel:
# yum install net-snmp net-snmp-devel
评论专区